Skip to content

Clear StrategyMarkerController in the same order as the other controllers - #27

Merged
wf9a5m75 merged 1 commit into
developfrom
fix/clear-followups
Nov 8, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
fix/clear-followups

Conversation

@wf9a5m75

@wf9a5m75 wf9a5m75 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

なぜ

StrategyMarkerController.clear()(クラスタリングなどの Strategy でマーカーを描くコントローラ)は、Strategy の中身を空にするだけで、描画担当の onRemove も onPostProcess も呼んでいませんでした。そのため clear しても、描画済みのマーカーが地図に残っていました。web の Strategy 用レンダラ(CollectorMarkerOverlayRenderer)は onPostProcess で初めて確定するので、web では GL 系に限らず全プロバイダで残っていました。

他のコントローラは MapConductor/android-sdk-core#27、MapConductor/ios-sdk-core#27、#26 で「onRemove(全部) → manager を空にする → onPostProcess」の順にそろえています。

何を変えたか

  • StrategyMarkerController.clear() を、add / update と同じ permit(web は lock)の中で「onRemove(全部) → strategy.clear() → onPostProcess」の順にしました。strategy.clear() は残しているので、クラスタ状態のリセットなど Strategy 固有の後片付けはそのままです。
  • 最初のカメラを待って保留していたマーカーも捨てます。捨てないと、clear 後の最初のカメラで描かれてしまいます。
  • iOS は StrategyMarkerController が actor でないため、pendingStates は permit の中でだけ触っています。

公開 API の変更はありません。

検証

  • 単体テスト StrategyMarkerClearOrder(Android / iOS / web)を足しました。直す前に落ち、直した後に通ることを確かめています。core の全テストも通過しました(Android 310、iOS 349(シミュレータ)、web 235)。
  • 実機・ブラウザ(SDK 内に呼び出し元が無いので、検証用ページから直接呼びました):
    • web(maplibre / mapbox / mappls / tomtom / longdo): 直す前は clear 後もマーカーが残り、直した後は消えて、送り直すと戻ります。
    • Android 実機(TomTom / MapTiler)と iPad 実機(MapLibre、MarkerClusterGroup 経由): 直す前は残り、直した後は消えます。

確認できていないもの: Android MapLibre と web MapTiler の Strategy マーカーは、検証用ページの問題で直す前・後とも描かれず、確かめられていません。

なお、clearOverlays() が Strategy コントローラを clear するようにする変更は、別の PR(fix/clear-strategy)で出す予定です。

関連 PR(fix/clear-followups の一式)

それぞれ独立していて、マージの順番の制約はありません(web の変更は js-sdk-core の新しい版を必要としません)。

…lers

clear() called onRemove and emptied the strategy but never
onPostProcess. On the web every provider hands strategies a
CollectorMarkerOverlayRenderer, which stages adds and removals and
commits them to the marker collector in onPostProcess, so the removals
were never committed and the markers stayed on the map (checked in the
browser on maplibre, mapbox, mappls, tomtom and longdo). The GL
renderers on android and iOS draw from the manager in onPostProcess,
which has the same effect.

clear() now runs onRemove(everything), strategy.clear() (so a
strategy's own bookkeeping, such as the cluster state, is still reset),
then onPostProcess, under the same lock as add/update. Markers queued
before the first camera are dropped too; they would otherwise appear on
the first camera event after clear().

Nothing in the SDK calls this clear() today (clearOverlays() clears the
providers' own controllers only), so the visible effect is for code
that drives a StrategyMarkerController directly.

StrategyMarkerClearOrder.test.mjs, matching the android-sdk-core and
ios-sdk-core tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant