supastash
Version:
Offline-first sync engine for Supabase in React Native using SQLite
36 lines • 1.47 kB
TypeScript
import { SupastashFilter } from "../../types/supastashFilters.types";
/**
* useSupastashFilters
*
* @description
* Registers filters used for Supastash pull sync logic.
*
* This hook should be called at app startup or anywhere your filter configuration might change.
* You should provide filters for **all tables** unless your Supabase project uses strict SELECT RLS (Row Level Security) policies.
*
* The hook validates filter structure, warns about invalid filters, and detects any mismatch in column/operator structure
* to prevent sync inconsistencies.
*
* 🚨 Incorrect or mismatched filters can lead to unreliable syncing behavior.
*
* @example
* ```ts
* useSupastashFilters({
* orders: [
* { column: "shop_id", operator: "eq", value: currentShopId },
* { column: "status", operator: "in", value: ["pending", "completed"] },
* ],
* inventory: [
* { column: "location_id", operator: "eq", value: activeLocationId },
* ],
* });
* ```
*
* @param {SupastashFilter} filters - An object where each key is a table name, and its value is
* an array of `RealtimeFilter` objects that define the filter criteria for that table's pull sync.
*
* @note This hook does not re-run unless the `filters` object reference changes.
* To force re-evaluation, pass a fresh object (not just mutated data).
*/
export declare function useSupastashFilters(filters?: SupastashFilter): void;
//# sourceMappingURL=index.d.ts.map