question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

🐛 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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
devongovettcommented, Sep 14, 2022

Make sure you aren’t using React StrictMode

2reactions
snowystingercommented, Oct 3, 2022

We’re tracking StrictMode here https://github.com/adobe/react-spectrum/issues/779

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment Variables in NextJS are Undefined
Save this question. Show activity on this post. I am using the next-auth library which requires the use of environment variables as follows:...
Read more >
FocusScope – React Aria - React Spectrum Libraries
FocusScope is a utility component that can be used to manage focus for its descendants. When the contain prop is set, focus is...
Read more >
Renovate Bot Package Diff
In order to support multiple copies of React Aria potentially\n// being on the page at once, the prefix is set to a random...
Read more >
Troubleshooting JSS Next.js apps - Sitecore Documentation
You can prevent most errors by performing the following steps: Verify that all environment variables used by the app have values. The sample...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found