adobe / adobe/react-spectrum

RAC TableBody with Suspense errors on SSR

Open
#8,976 5 comments 1 reaction 0 assignees View on GitHub
bug ssr
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the issue here

Having a `Suspense` in the TableBody throws an error while SSR

```tsx
... (

Loading...
)}/>}>



```

### 🤔 Expected Behavior?

The TableBody should be able to be wrapped in a `Suspense` boundary.

### 😯 Current Behavior

It throws:
```sh
TypeError: node.render is not a function
at children (file:///home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react-aria-components/dist/Collection.mjs:57:33)
at eval (file:///home/projects/github-cz6w3qva-7q9bvjmd/node_modules/@react-aria/collections/dist/useCachedChildren.mjs:40:32)
at Object.useMemo (/home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react-dom/cjs/react-dom-server.node.development.js:4027:20)
at process.env.NODE_ENV.exports.useMemo (/home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react/cjs/react.development.js:1251:34)
at $e948873055cbafe4$export$727c8fc270210f13 (file:///home/projects/github-cz6w3qva-7q9bvjmd/node_modules/@react-aria/collections/dist/useCachedChildren.mjs:34:31)
at $7135fc7d473fd974$var$useCollectionRender (file:///home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react-aria-components/dist/Collection.mjs:51:58)
at CollectionRoot (file:///home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react-aria-components/dist/Collection.mjs:44:16)
at Object.react_stack_bottom_frame (/home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react-dom/cjs/react-dom-server.node.development.js:10288:18)
at renderWithHooks (/home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react-dom/cjs/react-dom-server.node.development.js:5298:19)
at renderElement (/home/projects/github-cz6w3qva-7q9bvjmd/node_modules/react-dom/cjs/react-dom-server.node.development.js:5733:23)
```

### 💁 Possible Solution

_No response_

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

https://stackblitz.com/edit/github-cz6w3qva-7q9bvjmd?file=app%2Fcomponents%2Fuser-table.tsx

It only happens on SSR, if you navigate to the route with the link it works as expected, but if you refresh the page in the route `/table-suspense` it throws the error.

### Version

1.13.0

### What browsers are you seeing the problem on?

Chrome

### If other, please specify.

_No response_

### What operating system are you using?

MacOS

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the StackBlitz reproduction at app/components/user-table.tsx and refresh the /table-suspense route during SSR. Trace the node.render failure through Collection.mjs and useCachedChildren.mjs, then add or update a regression test showing that a Suspense-wrapped TableBody completes SSR without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.