Adopt the newest marker state when nothing is redrawn - #11
Merged
Conversation
A tiled marker whose look has not changed skipped the manager — correct, since re-registering would bust the tile cache and redraw every visible tile for a no-op — but it also left the entity pointing at the *previous* MarkerState. Taps are dispatched from the entity's state, so the handler that runs is the one from the composition before last. It matters because the generated id is a hash of the look — position, extra, icon, clickable, draggable, animation — and does not include the handlers. A MarkerState rebuilt on recomposition with new callbacks therefore arrives with the same id and an equal fingerprint, and its onClick never reaches the map. The non-tiled path was never affected: it always goes through `updated` and re-registers. This brings the tiled path in line with it, and with js-sdk-core, which had the same hole in both paths (MapConductor/js-sdk-core#3). ios-sdk-core re-registers unconditionally and never had it. Nothing is redrawn: the renderer is not called and the tile cache is not busted. Only the state reference the entity holds changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
症状
タイル描画のマーカーで、recomposition のたびに作り直される
MarkerStateのonClickが呼ばれない。呼ばれるのは前々回のハンドラで、地図を作り直すまで直らない。原因
自動生成される id は見た目のハッシュ(position / extra / icon / clickable / draggable / animation)で、ハンドラを含まない。だから
を recomposition のたびに作ると、「同じ id・等しい fingerprint・別インスタンス」が届く。
MarkerIngestionEngineのタイル経路はこれをunchangedと判断して何もしない。タイルキャッシュを捨てて可視タイル全部を描き直さないためで、そこは正しい。ただしエンティティが前のインスタンスを持ったままになり、タップはentity.stateから配送されるので古いハンドラが呼ばれる。非タイル経路は常に
updatedを通って再登録するので、元から影響なし。直し方
描画はこれまでどおり据え置いたまま、
prevEntity.state !== stateのときだけエンティティの state を差し替える。renderer は呼ばず、tiledDataChangedも立てないので、タイルの再生成は起きない。3 プラットフォームの状況
確認
:android-sdk-core:compileDebugKotlinBUILD SUCCESSFUL。同じ内容を js-sdk-core 側では回帰テストで固定してある(修正前は落ち、修正後は通る)。こちらは既存のテスト基盤に合う置き場が無かったため、テストは付けていない。