Skip to content

Commit

Permalink
Merge pull request #586 from oraichain/hotfix/clear-persist
Browse files Browse the repository at this point in the history
update clear cache persists
  • Loading branch information
haunv3 authored Feb 2, 2024
2 parents 8bf90c2 + e616828 commit 47505a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/layouts/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import './index.scss';
import { getSnap } from '@leapwallet/cosmos-snap-provider';
import { leapWalletType } from 'helper/constants';
import FutureCompetition from 'components/FutureCompetitionModal';
import { persistor } from 'store/configure';

const App = () => {
const [address, setAddress] = useConfigReducer('address');
Expand Down Expand Up @@ -90,7 +91,10 @@ const App = () => {
useEffect(() => {
const isClearPersistStorage = persistVersion === undefined || persistVersion !== PERSIST_VER;
const clearPersistStorage = () => {
localStorage.removeItem(`persist:${PERSIST_CONFIG_KEY}`);
persistor.pause();
persistor.flush().then(() => {
return persistor.purge();
});
setPersistVersion(PERSIST_VER);
};

Expand Down
2 changes: 1 addition & 1 deletion src/store/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// change version when update, add state redux-persist storage
export const PERSIST_VER = 1.6;
export const PERSIST_VER = 1.7;

export const PERSIST_CONFIG_KEY = 'root';

0 comments on commit 47505a1

Please sign in to comment.