Closed imtheaman closed 2 years ago
basically it's a react-router issue and requested as a feature, mentioned here https://github.com/remix-run/react-router/issues/8860
update: react-router doesn't seem to have the issue, as i mentioned above when i comment out <PersistGate>
i don't get the error anymore, so it's a redux-persist issue.
@codebutler please guide me a bit, i wanna persist my store.
mistakenly closed
okay. i've created my own persistent store. if there's any soln. please add it here. -----
I don't know why, but I simply added a layer of Suspense
out of my PersistGate
and it magically worked
Issue
when i use redux-persist alongwith redux-toolkit, it throws error when using lazy and suspense. when i comment out redux-persist code, there's no error. everythin's working normal.
Error
It's a React 18's concurrent ui related error, says to use useTransition hook, but don't know where to use it, i think implementation should be done inside the packages. when i load up the website, i have SecuredRoute component using router-v6, which checks if jwt token is in the store or not and based on that it navigates to home page or signin page. i think redux-persist is trying to load data from localstorage to the store, this way we have two tasks running together at the same time, one is changing the data which might cause transition error
SecuredRoute.tsx
store.ts