Skip to content

fix(useGeolocation): restore updates after effect replay - #2744

Open
yonash24 wants to merge 1 commit into
streamich:masterfrom
yonash24:fix/geolocation-effect-replay
Open

yonash24 wants to merge 1 commit into
streamich:masterfrom
yonash24:fix/geolocation-effect-replay

Conversation

@yonash24

Copy link
Copy Markdown

Fixes #2380.

Strict Mode replays effect setup/cleanup/setup. The first cleanup left the shared mounted flag false, so the new geolocation watcher could never finish loading. Keep the flag and callbacks local to each effect setup; callbacks from a cleaned-up watcher stay inactive.

Validation:

  • Both new replay tests fail before the fix; all 11 geolocation/mount/unmount tests pass after it.
  • Separate React 18.3.1 createRoot + StrictMode reproduction: baseline stays loading: true, patched source updates to false.
  • tsc --noEmit, changed-file ESLint (one existing options dependency warning) and Prettier pass.

The committed tests simulate effect replay using the repository's React 17 renderer. No dependency upgrade is included. Investigation, patch and tests are AI-assisted.

This branch has not been deployed

No deployments
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.

useGeolocation shows infinity loading after update to React 18 (only locally)

1 participant