From 398a85054f8dbccba416b4bdb820e671e8fca04e Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Sat, 7 Nov 2026 23:30:17 -0800 Subject: [PATCH] Template: clear registered strategy markers in clearOverlays() The template's clearOverlays() goes through BaseMapViewController.clearOverlayControllers() like the providers, and its conformance test now runs checkClearOverlaysReachesExtensions(), which fails on the old clearOverlays() (extension marker controller cleared 0 times) and passes now. Needs the js-sdk-core change on fix/clear-strategy. --- .../src/TemplateMapViewController.ts | 14 ++++++++------ .../test/TemplateDriverConformance.test.mjs | 10 ++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/react-for-template/src/TemplateMapViewController.ts b/react-for-template/src/TemplateMapViewController.ts index 6009e9d..fcbce32 100644 --- a/react-for-template/src/TemplateMapViewController.ts +++ b/react-for-template/src/TemplateMapViewController.ts @@ -193,12 +193,14 @@ export class TemplateMapViewController extends BaseMapViewController implements } async clearOverlays(): Promise { - await this.markerController.clear(); - await this.circleController.clear(); - await this.polylineController.clear(); - await this.polygonController.clear(); - await this.groundImageController.clear(); - await this.rasterLayerController.clear(); + await this.clearOverlayControllers([ + this.markerController, + this.circleController, + this.polylineController, + this.polygonController, + this.groundImageController, + this.rasterLayerController, + ]); } /** 地図の破棄。登録済みコントローラの後始末はコアがやる。 */ diff --git a/react-for-template/test/TemplateDriverConformance.test.mjs b/react-for-template/test/TemplateDriverConformance.test.mjs index 7aa7abe..a17105f 100644 --- a/react-for-template/test/TemplateDriverConformance.test.mjs +++ b/react-for-template/test/TemplateDriverConformance.test.mjs @@ -33,6 +33,16 @@ test('every overlay kind is reachable from the Capable facade and the cascade', MapDriverConformance.checkOverlaySlots(controller.overlayControllers); }); +/** + * `clearOverlays()` は自分の 6 つだけでなく、拡張が登録したマーカーのコントローラ + * (クラスタリングの `StrategyMarkerController` など)も clear すること。 + * `clearOverlayControllers()` を通さないと、ここで落ちる。 + */ +test('clearOverlays() reaches the marker controllers extensions register', async () => { + const controller = new TemplateMapViewController(new TemplateMap()); + await MapDriverConformance.checkClearOverlaysReachesExtensions(controller); +}); + test('zoom converter round-trips, is monotonic and clamps', () => { const controller = new TemplateMapViewController(new TemplateMap()); MapDriverConformance.checkZoomConverter(controller.zoomConverter);