Skip to content

Using <FocusScope> results in 'nodeToRestore' being set on Undefined (NEXT.js) #3515

@rafzan

Description

@rafzan

🐛 Bug Report

Trying to run any useSelect example from https://react-spectrum.adobe.com/react-aria/useSelect.html results in TypeError: Cannot set properties of undefined (setting 'nodeToRestore'). Searching for this error doesn't really return anything useful anywhere.

Wrapping on SSRProvider does nothing. Commenting <FocusScope /> and running the application works, but you lose almost all functionality related to dismissing popovers.

🤔 Expected Behavior

Example code should run without problems.

😯 Current Behavior

Unhandled Runtime Error
TypeError: Cannot set properties of undefined (setting 'nodeToRestore')

Call Stack
eval
../../node_modules/@react-aria/focus/dist/module.js (393:0)
commitHookEffectListMount
../../node_modules/react-dom/cjs/react-dom.development.js (23150:0)
invokeLayoutEffectMountInDEV
../../node_modules/react-dom/cjs/react-dom.development.js (25120:0)
invokeEffectsInDev
../../node_modules/react-dom/cjs/react-dom.development.js (27351:0)
commitDoubleInvokeEffectsInDEV
../../node_modules/react-dom/cjs/react-dom.development.js (27327:0)
flushPassiveEffectsImpl
../../node_modules/react-dom/cjs/react-dom.development.js (27056:0)
flushPassiveEffects
../../node_modules/react-dom/cjs/react-dom.development.js (26984:0)
commitRootImpl
../../node_modules/react-dom/cjs/react-dom.development.js (26935:0)
commitRoot
../../node_modules/react-dom/cjs/react-dom.development.js (26682:0)
performSyncWorkOnRoot
../../node_modules/react-dom/cjs/react-dom.development.js (26117:0)
flushSyncCallbacks
../../node_modules/react-dom/cjs/react-dom.development.js (12042:0)
eval
../../node_modules/react-dom/cjs/react-dom.development.js (25651:0)

🔦 Context

I'm trying to have JSX elements inside a custom <Select> component, just like in the StyledComponents example.
But any of the examples will crash.

💻 Code Sample

Can't seem to be able create a Next.js app on codesandbox as of now.
Locally, I just ran yarn create-next-app --ts myApp, copied the files to a folder and yielded the same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions