TableView fails to render on server side
See original GitHub issue🐛 Bug Report
TableView seems to fail during server-side rendering (SSR).
🤔 Expected Behavior
TableView should not fail to render on server side.
😯 Current Behavior
TableView seems to fail during server-side rendering and throws the following error:
window is not defined
💁 Possible Solution
Surround the render with a conditional:
{typeof window !== 'undefined' && <TableView />}
🔦 Context
We’re using NextJS, so SSR is pretty common.
💻 Code Sample
Any TableView excerpt from the online docs will fail during SSR.
🌍 Your Environment
| Software | Version(s) |
|---|---|
| react-spectrum | 3.15.1 |
| Browser | All |
| Operating System | All |
🧢 Your Company/Team
Adobe/RSP
🕷 Tracking Issue (optional)
N/A
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Retrieving data back from server side based on input
I'm doing a school project, its's multiple tables and tabBarControllers. Now, I want to display return data back from server side based on...
Read more >Smoothen your table view data loading using ...
The simplest approach would be loading all 100 data using URLSession at once in viewDidLoad , then update the table view data source...
Read more >TableView (JavaFX 8)
The TableView control is designed to visualize an unlimited number of rows of data, broken out into columns. A TableView is therefore very...
Read more >BSP: Server Side Printing for tableViews
This approach uses an ALV to print the table. The ALV will not display or print a nested table structure. In fact I...
Read more >TableView - React Spectrum Libraries - Adobe
Documentation for TableView in the React Spectrum package. ... See the docs for more information on how to perform server side sorting.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Sure, ones that happen during events like onFocus probably wont’ be an issue, just FYI, since you can’t focus something during SSR.
Sounds good. There may be a few more we want to handle while we’re at it:
https://github.com/adobe/react-spectrum/blob/3366ae36b3ddefbf67bfd084caaf58bb89ed345b/packages/%40react-aria/dnd/src/utils.ts#L56
https://github.com/adobe/react-spectrum/blob/9ba765f71bdde97d1545d91f76326e61bd35ae30/packages/%40react-aria/datepicker/src/useDateSegment.ts#L251