Skip to content

Call onAddStart / onAddEnd for filter changes and tile drawing too - #24

Merged
wf9a5m75 merged 1 commit into
developfrom
feat/tile-activity-progress
Nov 21, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
feat/tile-activity-progress

Conversation

@wf9a5m75

Copy link
Copy Markdown
Contributor

Needs MapConductor/js-sdk-core#53. Same rules as MapConductor/android-sdk-compose and MapConductor/ios-sdk-core#48.

Why

<Circles>, <Polylines> and <Polygons> called onAddStart only for a list that added states, and onAddEnd when those states' tiles were handed to the map. Drawing the tiles comes after that, so an app could not show that the map was still drawing after a filter change or a zoom.

New rules

  • onAddStart(total): every list hand-over starts. total is 0 when the list only removes or updates states. An empty list after an empty one calls nothing.
  • Tile drawing alone (a camera move) starts with onAddStart(0) once it has lasted 200 ms, so a move over drawn tiles calls nothing.
  • onAddEnd(total): after 400 ms with nothing coming, handed over or drawn. onAddProgress(total, total) comes just before it when total > 0.
  • Unchanged: progress at most every 100 ms, and starting over when new states come while others are being added.

For apps this means a filter that only hides states now calls start and end too, and every end comes at least 400 ms later than before. No public API change.

What

  • AddProgressTracker rewritten: track(added, removedIds, size), drawingChanged, injectable timers. DRAW_START_DELAY_MS and SETTLE_MS are exported.
  • useOverlayTileActivity(kind) finds the map's tiler activity. Circles, polylines and polygons pass it to useAddProgress; markers pass only the size.
  • test/addProgress.test.mjs rewritten; 27 tests pass, api surface dumped.

Checked (antenna sample, Chrome)

  • Verizon off: the sample's overlay went away 407 ms after the worker went idle.
  • Zoom: shown 200 ms into the drawing (plus the sample's own 150 ms), hidden 403 ms after idle.

The collections called onAddStart only for a list that added states, and
onAddEnd when those states' tiles were handed to the map, so an app could
not tell that the map was still drawing after a filter that only hid
states, or while the camera moved to undrawn tiles.

AddProgressTracker now counts as busy while states are coming, while the
map's tiler for this kind takes a list or has tiles drawn
(useOverlayTileActivity), and for 400 ms after a hand-over:
- any list starts (total 0 when it adds nothing); an empty list after an
  empty one still calls nothing;
- drawing alone starts once it has lasted 200 ms, so a camera move over
  cached tiles calls nothing;
- onAddEnd comes after 400 ms with nothing coming, handed over or drawn.
Counting, progress and starting over are unchanged. Same rules as
android-sdk-compose and ios-sdk.
@wf9a5m75
wf9a5m75 merged commit 98367ac into develop Nov 21, 2026
1 check passed
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