Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading '_internalRoot') #165

Open
cuitianze opened this issue May 21, 2022 · 7 comments
Open

Comments

@cuitianze
Copy link

React With single-spa

Uncaught TypeError: Cannot read properties of undefined (reading '_internalRoot')

with the function:

const createDevToolDataObject = (filteredSnapshot, diff) => {
    if (diff === undefined) {
      return {
        filteredSnapshot: filteredSnapshot,
        componentAtomTree: formatFiberNodes(
          recoilizeRoot._reactRootContainer._internalRoot.current,
        ),
      };
    } else {
      return {
        filteredSnapshot: filteredSnapshot,
        componentAtomTree: formatFiberNodes(
          recoilizeRoot._reactRootContainer._internalRoot.current,
        ),
        indexDiff: diff,
      };
    }
  };

same issue with

Originally posted by @adamdaly in #136 (comment)

@tsepen
Copy link

tsepen commented May 27, 2022

@ZeroPie
Copy link

ZeroPie commented Jun 2, 2022

Can reproduce it.
"recoilize": "^3.1.6"
"next": "12.1.6",

@hodler-buidler
Copy link

Same for me.
React 18, custom webpack build.
Cannot read properties of undefined (reading '_internalRoot')

@jimjiminyjimjim
Copy link

Has anyone found a workaround or solution for this?

React 18.1.0
NextJS 12.1.6

@boenfu
Copy link
Contributor

boenfu commented Jun 27, 2022

#172
Not sure if it's the best way
But it can work in a single React.createRoot environment

@arthwood
Copy link

This issue happens when render is used as a standalone function instead of a method, do:

const root = createRoot(container)

root.render(<App />)

instead of:

const { render } = createRoot(container)

render(<App />)

@igorrfc
Copy link

igorrfc commented Jun 15, 2023

@arthwood you, sir, are the real hero. Thanks, it worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants