Skip to content

fix: prevent api provider race condition, defer loading state update#970

Merged
usefulthink merged 1 commit intovisgl:mainfrom
mrMetalWood:fix/api-provider-race-condition
Apr 24, 2026
Merged

fix: prevent api provider race condition, defer loading state update#970
usefulthink merged 1 commit intovisgl:mainfrom
mrMetalWood:fix/api-provider-race-condition

Conversation

@mrMetalWood
Copy link
Copy Markdown
Collaborator

Reproduced and confirmed problem and solution of #968 and applied suggested fix

Summary

Fixes an APIProvider race when google.maps.importLibrary is already installed by an external loader, but the Maps JavaScript API has not finished loading yet.

Previously, the external-loader fast path marked the API as LOADED before awaiting importLibrary('core') and importLibrary('maps'). This allowed provider effects and child components to run too early, causing errors such as google.maps.Settings is undefined or google.maps.Map is not a constructor.

Changes

  • Wait for required libraries to resolve before setting APILoadingStatus.LOADED in the external-loader fast path.
  • Add a regression test for externally installed google.maps.importLibrary with google.maps.Settings initially unavailable.

closes #968

@mrMetalWood mrMetalWood requested a review from usefulthink April 24, 2026 12:34
Copy link
Copy Markdown
Collaborator

@usefulthink usefulthink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Seems like a simple enough fix that we can release it right away.

@usefulthink usefulthink merged commit 7fd6efe into visgl:main Apr 24, 2026
2 checks passed
@cramt
Copy link
Copy Markdown

cramt commented Apr 24, 2026

amazing, thanks for the quick fix ❤️

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.

[Bug] APIProvider 1.8.x crashes with "google.maps.Settings is undefined" due to race in LOADED fast-path

3 participants