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

errors nextjs #106

Open
UXDart opened this issue May 28, 2023 · 0 comments
Open

errors nextjs #106

UXDart opened this issue May 28, 2023 · 0 comments

Comments

@UXDart
Copy link

UXDart commented May 28, 2023

Hello. I'm having a lot of errors. found the errors to happen when calling to useSyncedStore() in different components at the same screen, same store. this is on last React and NextJS

Unhandled Runtime Error
TypeError: Cannot read properties of null (reading 'removeObservers')

Call Stack
eval
node_modules/@reactivedata/react/dist/reactive-react-bindings.module.js (35:0)
safelyCallDestroy
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (19741:0)
commitHookEffectListUnmount
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (19923:0)
commitHookPassiveUnmountEffects
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22550:0)
commitPassiveUnmountInsideDeletedTreeOnFiber
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22750:0)
commitPassiveUnmountEffectsInsideOfDeletedTree_begin
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22706:0)
recursivelyTraversePassiveUnmountEffects
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22568:0)
commitPassiveUnmountOnFiber
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22629:0)
recursivelyTraversePassiveUnmountEffects
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22582:0)
commitPassiveUnmountOnFiber
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22596:0)
recursivelyTraversePassiveUnmountEffects
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22582:0)
commitPassiveUnmountOnFiber
node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js (22629:0)

there seems to be a loop. I saw that some hooks are using the concept of being "mounted" something that doesn't work for some time in React 18. the two questions are, 1) is it possible to call removeObservers only if the parent is still there? b) is it being unmounted and removed without removing observers now?

I will try to add a ? here for example, but I'm not sure if it is only that or an edge case is happening?

return () => {
  mounted.current = false;
  observer.current?.removeObservers();
  observer.current = null;
};

Thanks

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

1 participant