Skip to content

fix: emit current camera in post-frame size change event - #2271

Closed
WudgeJalk wants to merge 1 commit into
fleaflet:masterfrom
WudgeJalk:fix/stale-camera-size-change
Closed

WudgeJalk wants to merge 1 commit into
fleaflet:masterfrom
WudgeJalk:fix/stale-camera-size-change

Conversation

@WudgeJalk

@WudgeJalk WudgeJalk commented Oct 1, 2026 •

Copy link
Copy Markdown

Fixes #2270

Cause: _updateAndEmitSizeIfConstraintsChanged captures the camera at layout and emits it in a post-frame callback. A move/fitCamera from an earlier post-frame callback is overtaken by this stale event, so a debounced TileLayer loads/prunes for the pre-move camera.

Fix: read _mapController.camera when emitting, not at layout.

Test: test/layer/tile_layer/tile_update_after_early_fit_test.dart — fails without the fix (only z3 tiles load), passes with it.

Generated with Claude Code

@JaffaKetchup

Copy link
Copy Markdown
Member

Please see why the attached issue was closed.

Out of an abundance of caution changing this code, I don't want to do it without good reason. And why this may seem to make sense, I cannot be sure that this will not break something else. Especially as the initial bug report seemed to be suggesting that this was reproducing using explicitly unsupported behaviour (use of the controller to set the camera before first build).

If I've misunderstood something, please ping me, and I'll have a second look.

Worth noting for readers that this part of code goes all the way back to the big state rewrites in v6 at

final newMapCamera = _flutterMapInternalController.camera;
. While that PR certainly had its issues, it's overall still intact and how we layout the map today.

@WudgeJalk

WudgeJalk commented Oct 9, 2026 •

Copy link
Copy Markdown
Author

See #2270 (comment): the same failure reproduces through onMapReady, the documented route, on a clean v8.3.2. Test for that shape added to the branch (e24ada8).

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.

Stale camera in post-frame nonRotatedSizeChange discards tiles when a debounced tileUpdateTransformer keeps only the last event

2 participants