π Manual Refresh
Need to manually trigger a refresh? Use these from:
import {
refreshTable,
refreshAllTables,
} from "supastash/utils/sync/refreshTables";
π refreshTable(table: string): voidβ
For refreshing one table's local data:
refreshTable("orders");
Emits a refresh:orders event. Re-fetches local rows + triggers UI update.
π refreshAllTables(): voidβ
Refreshes everything:
refreshAllTables();
Good after a full sync or reset.
β οΈ refreshTableWithPayload() (Deprecated)β
This used to manually reflect data in the UI. No longer needed β use Supastash queries or refreshTable().
// Deprecated β avoid
refreshTableWithPayload("orders", { id: "abc", ... }, "update");
π Behind the Scenesβ
- π Supastash uses a version-based cache: if nothing changes, no re-renders.
- π§Ό Realtime listeners are de-duped per
table + filter. - β‘ Flushes UI updates only after debounce (default 100ms).
- π§ Grouped maps (via
extraMapKeys) useMap<string, R[]>.
π‘ Best Practicesβ
- Use
dataMapfor instant lookups (e.g.,dataMap.get(id)) - Use
groupedBy.chat_idfor message grouping - Use
lazy: truein modal screens or deeply nested routes - Bump
flushIntervalMshigher if syncing high-volume tables - Leverage
onPushToRemotefor custom API pipelines