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

Uncaught TypeError: Cannot read properties of null (reading 'unsubscribe') #216

Closed
AjithKumarvm opened this issue Sep 21, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@AjithKumarvm
Copy link

File: /node_modules/react-sweet-state/lib/esm/components/hook.js

        // On component unmount we unsubscribe to storeState updates
        subscription.unsubscribe();
        subscription = null;
      };

Its a runtime error. happens randomly. version "react-sweet-state": "2.6.0". Critical bug, crashes the entire website
I am using react-sweet-state with react": "18.2.0" and "vite": "^4.2.1"

@AjithKumarvm
Copy link
Author

I would have raised a PR to fix this issue, but couldn't find this particular line of code in the src folder of react-sweet-state.

@albertogasparin albertogasparin added the bug Something isn't working label Sep 21, 2023
@albertogasparin
Copy link
Collaborator

Can you try upgrading to latest, v2.7.x ? Those lines of code do not exist anymore

@AjithKumarvm
Copy link
Author

AjithKumarvm commented Sep 22, 2023

You are right! @albertogasparin. I checked the source code of v2.6.0. I found this line inside hook.js. But its not found in further releases. I will upgrade the package to latest and test it.

@AjithKumarvm
Copy link
Author

Hi @albertogasparin. I cannot use 2.7.1 since it has another bug. Focus on a controlled input text box which has some text already, place the cursor in between words and on typing the cursor moves to the end of the text abruptly.

@AjithKumarvm
Copy link
Author

2.7.1 has this issue precisely: #178

@albertogasparin
Copy link
Collaborator

Ok, that is a different limitation tho (affecting 2.6.0 too). Happy to keep talking about solutions on #178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants