Skip to content

fix: derive non-marker children synchronously to avoid stale map layers#293

Open
tim-baecker wants to merge 1 commit into
tomekvenits:masterfrom
tim-baecker:fix/sync-non-marker-children
Open

fix: derive non-marker children synchronously to avoid stale map layers#293
tim-baecker wants to merge 1 commit into
tomekvenits:masterfrom
tim-baecker:fix/sync-non-marker-children

Conversation

@tim-baecker

Copy link
Copy Markdown

Problem

Non-marker children (Polyline, Overlay, etc.) were stored in React state and only updated in useEffect after splitting propsChildren. When those children were removed from props (e.g. toggling map layers off), native map views could stay on screen even though React no longer rendered them.

Solution

Derive non-marker children synchronously with useMemo from propsChildren (same rules as before: all children when clusteringEnabled is false, otherwise everything that is not a Marker). The clustering useEffect only builds rawData from markers.

Notes

  • Behavior for clustering and spider lines is unchanged; only the source of truth for “other” children is fixed.
  • Tested in an app using many polylines + toggling visibility.

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