atlassian / react-sweet-state

Shared state management solution for React

Home Page:https://atlassian.github.io/react-sweet-state/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

AjithKumarvm opened this issue · comments

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"

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.

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

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.

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.

2.7.1 has this issue precisely: #178

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