Skip to content

Commit

Permalink
fix: correct persistance after table reset
Browse files Browse the repository at this point in the history
  • Loading branch information
schummar committed Sep 9, 2022
1 parent 9156968 commit 9369988
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/internalState/tableStateStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function useTableStateStorage(table: Store<InternalTableState<any>>) {
return () => {
isCanceled = true;
};
}, []);
}, [table]);

// After isHydrated, watch and save state
useEffect(() => {
Expand Down Expand Up @@ -180,7 +180,7 @@ export function useTableStateStorage(table: Store<InternalTableState<any>>) {
},
{ throttle: 1000 },
);
}, [isHydrated]);
}, [table, isHydrated]);

async function clear() {
await q.run(async () => {
Expand All @@ -192,6 +192,7 @@ export function useTableStateStorage(table: Store<InternalTableState<any>>) {
const { storage, id } = persist;
await storage.removeItem(storageName(id));

setIsHydrated(false);
q.clear();
});
}
Expand Down

0 comments on commit 9369988

Please sign in to comment.