Closed SamAdobe closed 5 months ago
Notes for whoever picks this up: possibly the same mode of failure as https://github.com/adobe/react-spectrum/issues/4761
Did some digging, was able to reproduce locally. It is indeed the same mode of failure that we've seen in our other virtualized components aka calculation loops when scrollbars appear and disappear. In this case, as the window resizes, the dynamic height CardView gains a vertical scroll bar because its last calculated height was taller than the space afforded to it by its parent container. This scrollbar causes a resize to happen for the CardView since it takes up room and the CardView recalculates its layout to adapt to the new width set. After it resizes itself, the scrollbar disappears and the CardView tries to resize itself to fill the horizontal space recently vacated by the scrollbar. This results in the CardView reverting back to its larger state and the scrollbar returns, causing a infinite loop to happen.
Note that similar to TableView, we only support CardViews with specified height so the virtualization and async load more can work properly: https://github.com/adobe/react-spectrum/wiki/Frequently-Asked-Questions-(FAQs)#why-do-i-need-a-constrained-height-on-my-react-spectrum-tableview. Let us know if applying a height doesn't fix the issue.
@LFDanLu I am still able to able to reproduce this issue after applying a height to the CardView. See this edited sandbox: https://codesandbox.io/p/sandbox/laughing-merkle-v674my
Note that I can reliably and easily reproduce the issue on Mac when scrollbars are set to always show.
Thanks for the update, I'll reopen this issue. The comment from https://github.com/adobe/react-spectrum/issues/5152#issuecomment-1804885598 is then still relevant most likely, but I recall this not being a problem locally so I'll have to dig some more.
Provide a general summary of the issue here
When resizing a browser window containing a CardView, React crashes with "Maximum update depth exceeded". See attached sandbox for repro case.
๐ค Expected Behavior?
Card view should resize without crashing
๐ฏ Current Behavior
React crashes.
๐ Possible Solution
No response
๐ฆ Context
No response
๐ฅ๏ธ Steps to Reproduce
https://codesandbox.io/s/ecstatic-flower-c7vc97?file=/src/App.js
Resize your window to cause scroll bars to appear and reappear. After a while, React will crash.
Version
3.30
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Windows 10 Enterprise, 21H2 OSX 12.6.8
๐งข Your Company/Team
Adobe - Project Sunrise (3D&I)
๐ท Tracking Issue
No response