-
Couldn't load subscription status.
- Fork 1.3k
Description
Provide a general summary of the issue here
I started building a design system on top of React Aria Components. The application that uses it is built using TanStack Router and Apollo Client. Both of them use Suspense for data fetching. At first this seems to work fine but things are starting to get very weird when it comes to things like infinite scrolling (meaning loading more data on scroll) for example. While wrapper components properly re-render with the updated data these updates aren't displayed by RAC components. It gets even weirder: When a component got into this broken state, simply clicking anywhere on the screen causes the table to be simply emptied. No errors or warnings.
I'm still trying to come up with a minimal reproducible example but wanted to open this issue already as you might be aware of undocumented shortcomings with RAC and Suspense already. I suspect that the fake DOM implementation that tables use might the culprit here but I'm still collecting details.
🤔 Expected Behavior?
Things to not break. More details on reproduction case below.
😯 Current Behavior
As described in summary.
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
https://codesandbox.io/p/sandbox/tender-resonance-76wlzv?file=%2Fsrc%2FLocationsTable.jsx%3A47%2C15
RAC.Suspense.Issue.mp4
fetchMore of Apollo Client re-suspends by default, meaning it should show the nearest Suspense fallback. Which it does but instead of replacing all rows it only shows it (Loading...) in addition. While this might seem correct from a UX perspective it's not what would be expected from a technical viewpoint. You can try the same with raw HTML tags and it will replace the whole body by Loading... instead of temporarily appending a new row.
It gets even worse when wrapping the fetchMore call in startTransition. This should be done to avoid suspending to the nearest fallback and instead keep the previous UI mounted while the fetch is ongoing. At first this seems to work but as soon as the component re-renders the table simply doesn't display the newly fetched rows. The wrapping component gets correctly re-rendered, also the new rows are there (see console.log).
Version
1.1.1
What browsers are you seeing the problem on?
Microsoft Edge
If other, please specify.
No response
What operating system are you using?
macOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status