antd-crud-table API
    Preparing search index...

    Interface LocalStorageStrategy<T, K>

    Serves records persisted to localStorage.

    interface LocalStorageStrategy<T, K extends keyof T> {
        defaultPageSize?: number;
        generateId?: IdGenerator<T, K>;
        initialData?: readonly T[];
        locale?: Partial<CrudTableLocale>;
        notifications?: boolean;
        onError?: (operation: CrudOperationName, error: Error) => void;
        onSuccess?: (operation: CrudOperationName, payload: unknown) => void;
        optimisticUpdates?: boolean;
        refreshAfterMutation?: boolean;
        storageKey: string;
    }

    Type Parameters

    • T
    • K extends keyof T

    Hierarchy

    • UseCrudTableOptionsBase<T, K>
      • LocalStorageStrategy
    Index
    defaultPageSize?: number

    Rows per page for the hook's own reads. Defaults to 10.

    generateId?: IdGenerator<T, K>

    Replaces the built-in identity policy for the in-memory strategies.

    initialData?: readonly T[]

    Records used when the key holds nothing readable.

    locale?: Partial<CrudTableLocale>

    Overrides for the toast wording.

    CrudTable passes its own resolved locale down, so this is only needed when the hook is used on its own.

    notifications?: boolean

    Show antd toasts for the outcome of each operation.

    onError?: (operation: CrudOperationName, error: Error) => void

    Called when an operation fails, with a real Error rather than the raw throw.

    onSuccess?: (operation: CrudOperationName, payload: unknown) => void

    Called after an operation succeeds, with whatever it produced.

    optimisticUpdates?: boolean

    Apply mutations to local state immediately instead of re-reading.

    Trades consistency for responsiveness: server-assigned fields will not be reflected until the next list.

    refreshAfterMutation?: boolean

    Re-read the list after a successful mutation.

    Defaults to true for standalone hook consumers, which render from state.data. CrudTable sets it false: it renders from ProTable's own request pipeline and reloads through actionRef, so leaving this on issued two list requests for every write.

    storageKey: string

    The localStorage key records are stored under.