Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer all observers until after activation #282

Merged
merged 2 commits into from Nov 15, 2022
Merged

Conversation

philipwalton
Copy link
Member

@philipwalton philipwalton commented Nov 15, 2022

This PR fixes #271 by adding a new whenActivated utility and using it to defer all of the onXXX() metric functions. It also tweaks the getVisibilityWatcher() logic to better handle prerendering cases (which always happens when the visibilityState is "hidden", and are thus tricky to get right).

Note: make sure to look at the diff ignoring whitespace, otherwise it looks like much more changed than did.

Co-authored-by: Barry Pollard <barrypollard@google.com>
@philipwalton
Copy link
Member Author

@tunetheweb committed your suggestion. LGTY otherwise?

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.

Observer callbacks should be deferred until after activation
2 participants