Repository navigation
Document that state fields only see assignments, not in-place edits - #32
Merged
Merged
Conversation
PolygonState.points/holes, PolylineState.points and RasterLayerState.extraHeaders are watched only through assignment. A list passed in and then edited in place (mutableStateListOf, MutableList) is never redrawn, and re-assigning the same edited list is dropped as equal. Say so on the fields and on ComponentState.mutations / StateMutationSignal.notifying. KDoc only.
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.
なぜ
07e614f 以降、ComponentState は自分のプロパティへの代入でだけ変更を通知する。リストをその場で書き換えても、内容の等しいリストを代入し直しても通知されない。example の Polygon / Polyline ページがこの書き方で頂点ドラッグに追従しなくなっていた(MapConductor/android-sdk#116 で example 側を直した)。この性質が KDoc に書かれていなかった。
何を変えたか(KDoc のみ。振る舞い・公開 API は変えていない)
PolygonState.points/holes、PolylineState.points: 見ているのは代入だけ。mutableStateListOfを渡してその場で書き換えても描き直されない。新しいリストを代入する(例つき)。内容の等しいリストの代入は無視される。RasterLayerState.extraHeaders: Map も同じ。ComponentState.mutations、StateMutationSignal.notifying: 一般則として同じことを一文。検証
OverlayCollectorMutationTest5 件 pass。関連: MapConductor/website-2nd の docs/state-assign-new-list(サンプルのコメント)。