chore: store pagination for list

This commit is contained in:
jialin
2026-03-17 16:35:55 +08:00
committed by jialin
parent e241c6cb6f
commit ed4be2328f
6 changed files with 100 additions and 6 deletions
+20
View File
@@ -0,0 +1,20 @@
import { getDefaultStore } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
export interface PaginationState {
perPage: number;
}
export const paginationAtom = atomWithStorage<Record<string, any>>(
'paginationStatus',
{},
undefined,
{ getOnInit: true }
);
export const getPaginationStatus = (key: string) => {
if (!key) return {};
const store = getDefaultStore();
const cache = store.get(paginationAtom);
return cache[key] || {};
};