Recoilize icon indicating copy to clipboard operation
Recoilize copied to clipboard

index.js:201 Uncaught TypeError: Cannot read properties of undefined (reading '_internalRoot') at createDevToolDataObject (index.js:201:1)

Open ofirrifo opened this issue 2 years ago • 9 comments

I just install recoilize to chrome https://chrome.google.com/webstore/detail/recoilize/jhfmmdhbinleghabnblahfjfalfgidik

and install the npm package "recoilize": "^3.1.6",

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <StrictMode>
    <RecoilRoot>
      <RecoilizeDebugger />
      ....SOME OTHE COMPONENTS
    </RecoilRoot>
  </StrictMode>
);

and I get this error:

index.js:201 Uncaught TypeError: Cannot read properties of undefined (reading '_internalRoot')
    at createDevToolDataObject (index.js:201:1)
    at index.js:98:1
    at commitHookEffectListMount (react-dom.development.js:23150:1)
    at commitPassiveMountOnFiber (react-dom.development.js:24926:1)
    at commitPassiveMountEffects_complete (react-dom.development.js:24891:1)
    at commitPassiveMountEffects_begin (react-dom.development.js:24878:1)
    at commitPassiveMountEffects (react-dom.development.js:24866:1)
    at flushPassiveEffectsImpl (react-dom.development.js:27039:1)
    at flushPassiveEffects (react-dom.development.js:26984:1)
    at react-dom.development.js:26769:1

For some reason _reactRootContainer is not define recoilizeRoot._reactRootContainer

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

ofirrifo avatar Feb 09 '23 16:02 ofirrifo

I'm also experiencing this. I was wondering if there is a workaround?

erickarnis-tb avatar Feb 28 '23 18:02 erickarnis-tb

I am also suffering from this issue.

davit-b avatar Mar 21 '23 14:03 davit-b

Even passing the root app doesn't work: <RecoilizeDebugger root={root} />

zbyte64 avatar Mar 21 '23 20:03 zbyte64

I solved it with this https://github.com/open-source-labs/Recoilize/pull/172#issuecomment-1319585299

It's not great, but better than it just not working at all.

davit-b avatar Mar 22 '23 12:03 davit-b

Yeah, unfortunately I don't think that's not an adequate fix for most of us. I was pretty hyped to add it back in today, but let down when I ran into this issue because I was tracking #172 but it didn't solve the problem.

This issue is also tracked here: https://github.com/open-source-labs/Recoilize/issues/165

mawburn avatar Apr 26 '23 20:04 mawburn

Yeah, unfortunately I don't think that's not an adequate fix for most of us. I was pretty hyped to add it back in today, but let down when I ran into this issue because I was tracking #172 but it didn't solve the problem.

This issue is also tracked here: #165

@mawburn

I honestly just switched to Jotai. Jotai is atom-based state just like Recoil but with none of the sharp edges... And it's actively being developed.

davit-b avatar Apr 26 '23 20:04 davit-b

I think this library has been abandoned, the last commit was ages ago. Does anyone know of a good alternative?

erickarnis-tb avatar Apr 26 '23 20:04 erickarnis-tb

I honestly just switched to Jotai. Jotai is atom-based state just like Recoil but with none of the sharp edges... And it's actively being developed.

My team hasn't had any issues with Recoil and it seems to be in active development. Just this helper plugin seems to be abandoned.

  • https://github.com/facebookexperimental/Recoil/releases
  • https://github.com/facebookexperimental/Recoil/commits/main

Either way, I was just posting to let other people know who are running into this issue.

mawburn avatar Apr 26 '23 20:04 mawburn

Sorry, I was referring to this plugin.

erickarnis-tb avatar Apr 26 '23 20:04 erickarnis-tb