-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix race condition when performing swap for fallback #7945
Conversation
🦋 Changeset detectedLatest commit: 2a6a23a The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
// If there are no animations, go ahead and swap on next tick | ||
// This is necessary because we do not know if there are animations. | ||
// The setTimeout is a fallback in case there are none. | ||
setTimeout(() => !isAnimating && swap()); | ||
var timeout = setTimeout(() => !isAnimating && fallbackSwap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a valid use of var
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also hoist up a let
😄 var
would bleed out of this if block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think that hoisting a let
is more explicit. If it's impossible, we should leave a comment explaining why var
needs to be used. E.g.: like TypeScript does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my I totally forgot that a let does hoist too 🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok fixed. Let's never speak of this again.
Thanks @matthewp for this one. I tried using ViewTransitions in 2.10.1 and on Firefox some pages returned a 'null' instead of loading the body of the page. I think this update has resolved it. |
Changes
Testing
Docs
Bug fix