Fix TableView resize observer loop limit#5432
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.
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: