-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix TableView resize observer loop limit #5432
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
Conversation
Closed #5367 in favor of this change |
let raf = useRef<ReturnType<typeof requestAnimationFrame> | null>(); | ||
let onResize = () => { | ||
if (isOldReact) { | ||
raf.current ??= requestAnimationFrame(() => { |
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.
React 16 and 17 don't batch like 18. We instead emulate that (to a degree) by waiting for a raf before submitting our state changes
We also tried unstable_batchupdates, which solved most of the issue. However, when the scrollbar appeared, we got the dreaded loop limit exceeded. This is likely because two updates were coming in faster than a single raf. First, the rect size change due to the resize of the window. Second, a rect size change due to the scroll bar appearing.
Build successful! 🎉 |
Build successful! 🎉 |
## API Changes
unknown top level export { type: 'any' } |
Closes #1924
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: