-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Fixed rAF throttling issue caused by new Chrome flag #39
Conversation
Chrome's new "Throttle non-visible cross-origin iframes" flag causes problems for code running inside of hidden iframes. In this case, animation frames get scheduled without any error but never get called. This causes problems for the React DevTools browser extension specifically. This commit adds a workaround by scheduling a backup timeout along with animation frames. In the normal case, these timeout will be cancelled by the animation frame (which will run first). For more info, see facebook/react#21986
By upgrading react-virtualized-auto-sizer to 1.0.6 See bvaughn/react-virtualized-auto-sizer#39
By upgrading react-virtualized-auto-sizer to 1.0.6 See bvaughn/react-virtualized-auto-sizer#39
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.
was just curious about the fix! awesome!
} else { | ||
windowObject = global; | ||
} | ||
|
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.
not sure if using Flow/TS, but is there any scenario where the window object would still be null here?
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.
No. The else
here falls back to global when window
and self
are undefined. One of the three should always be present.
return setTimeoutFn(callback, TIMEOUT_DURATION); | ||
}; | ||
} else { | ||
// Counter intuitively, environments that support animation frames can be trickier. |
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.
also assuming there’s no possibility that one of the raf/cancel functions are not null without the other also not being null, right?
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.
If either request or cancel function is null, we'll hit the above timeout based code path.
…22083) By upgrading react-virtualized-auto-sizer to 1.0.6 See bvaughn/react-virtualized-auto-sizer#39
Chrome's new "Throttle non-visible cross-origin iframes" flag causes problems for code running inside of hidden iframes. In this case, animation frames get scheduled without any error but never get called. This causes problems for the React DevTools browser extension specifically.
This commit adds a workaround by scheduling a backup timeout along with animation frames. In the normal case, these timeout will be cancelled by the animation frame (which will run first).
For more info, see facebook/react#21986