Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Always call onSourceLoaded observers - #15548

Merged
springmeyer merged 3 commits into
masterfrom
always-call-source-load-observers
Sep 4, 2019
Merged

springmeyer merged 3 commits into
masterfrom
always-call-source-load-observers

Conversation

@kkaefer

@kkaefer kkaefer commented Sep 3, 2019 •

Copy link
Copy Markdown
Member

When no network requests have to be made because the TileJSON metadata is included inline in a style, we never triggered a onSourceLoad call. This PR adds calls.

We found this by way of #15514. Here's what happened:

  • We are moving the addition of the new Source object to the sources collection in the style to before we call loadDescription. In that call, however, we are mutating the implementation and updating baseImpl. Now, the impl pointer in the collection is out of date with the updated impl. If we never schedule a onSourceLoadeded, we never call sources.update(...) if no other sources are loaded, so the change is not picked up.
  • This only happened when the TileJSON was specified inline, if we loaded it from the network, we correctly fired the onSourceLoaded event.

This PR includes and supersedes #15531.

After merge:

/cc @springmeyer

@kkaefer
kkaefer force-pushed the always-call-source-load-observers branch from 89afc63 to 861d5d6 Compare September 3, 2019 09:24

@alexshalamov alexshalamov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm!

@springmeyer springmeyer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 confirmed that this fixes my downstream crash as well. Thank you @kkaefer !

@tmpsantos

Copy link
Copy Markdown
Contributor

I'm suspecting this fixed an issue that I was seeing on the Thread Sanitizer bot. I will bisect to double check. cc @pozdnyakov

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants