Skip to content

useIsSSR with I18nProvider breaks Virtualizer in react-aria-components 1.9.0 in Next.js #8293

Closed
@korri123

Description

@korri123

Provide a general summary of the issue here

See reproducer repository, to test run npm run dev and open the page in http://localhost:3000
Happened upgrading react-aria-components to from 1.8.0 to 1.9.0

Error: Error: Cannot destructure property 'key' of 'reusableView.content' as it is null. in Virtualizer component

If you remove the useIsSSR hook, or any hook that uses that hook such as useFilter it stops breaking.
Just calling

React['useSyncExternalStore'](subscribe, getSnapshot, getServerSnapshot)

Which useIsSSR does is enough to reproduce as well

Image

🤔 Expected Behavior?

It will work as it did previously

😯 Current Behavior

There will be an error Error: Cannot destructure property 'key' of 'reusableView.content' as it is null.

💁 Possible Solution

No response

🔦 Context

Next.js app, we noticed a regression in our table components

🖥️ Steps to Reproduce

Steps to reproduce:

  1. In Next.js app, base layout.tsx, include <I18nProvider locale={'en-US'}> around children through a client component
  2. In page.tsx, include client component with <Virtualizer/>, <Table>, <TableHeader> and everything required for a table and a useIsSSR hook call, or the useSyncExternalStore call with a server snapshot callback

For a reproducer, I've made a repository here: https://github.com/korri123/react-aria-issue

Version

^3.40.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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions