Skip to content

Caching and Refresh

A browser cache remembers successful reads so the same page may be reused. It does not save moved cards or enforce server-side permissions.

The read engine is built in. Keep your existing loadData callback and add only the remote.query options you need.

Interactive example · supplied HTTP demo backend

Reuse a fresh server response

This small board loads all 24 cards in one request and uses a 30-second Query freshness window.

Try it: Reopen the same board, then force a server refresh. Compare the HTTP read counter.

Starting demo backend…

HTTP reads: 0 · writes: 0

What to notice: Reopening can reuse fresh Query data; explicit refresh requests current backend data. No extra app cache is implemented.

TypeScript source

The supplied backend handlers use MSW simulation in the browser. Replace the transport with your application endpoint.

remote-caching.ts
import { createDataQueryContext } from '@revolist/revogrid-pro';
import { remoteBoard } from './remote-board';
export function sharedRemoteBoard(apiUrl: string) {
const context = createDataQueryContext();
const config = remoteBoard(apiUrl);
return {
config: { ...config, remote: { ...config.remote!, chunkSize: 24, query: {
retry: false, staleTime: 30_000,
source: context.source({ sourceId: apiUrl, schemaId: 'cards-v1', tenantId: 'demo', authorizationScope: 'demo' }),
} } },
destroy() { context.dispose(); },
};
}
// This small cache example loads all 24 cards at once, keeping paging separate.
// Reuse this config/source while reopening the SAME app dataset.
// Keep tenant and authorization identity accurate in your application.
// Dispose the context when the app no longer owns this shared read scope.
Download remote-caching.ts

Try it: choose Reopen same board, then Refresh from server. Compare the HTTP read counter: reopening can reuse the fresh response, while refresh requests authoritative server state.

grid.kanban = {
...config,
remote: {
...remote,
query: { staleTime: 30_000, retry: 1 },
},
};

Here remote is your existing loader configuration. staleTime is the period during which a successful page can be considered fresh. retry applies to failed reads, not to saves.

Call await kanban.refreshRemote() to discard the current sequence or reset indexed placeholders and read page zero freshly. This explicit refresh also clears local history. Native automatic refetch updates loaded positions without recording a local edit and retains the current history stack.

KanbanRemoteConfig.query optionally configures the built-in whole-board read engine. Existing loadData(skip, limit) callbacks keep working. See remote card pages for append and indexed layout contracts and cancellation examples.

Type / propertyContract
KanbanRemoteConfig<Card>.queryKanbanRemoteQueryOptions | false; exported by @revolist/kanban, optional, defaults to fresh reads and a private context.
KanbanRemoteQueryOptionsOmit<LoadQueryOptions<never>, 'consistency' | 'reconcile'>. Native fields from configuration types apply to mounted blocks/sequences.
query.sourceOptional DataQueryScope created through createDataQueryContext from Pro. Share only equivalent dataset/schema/tenant/authorization scopes.
query: falseDirect manual reads, without query caching or native automatic refetch/retry.
import type { KanbanRemoteQueryOptions } from '@revolist/kanban';
const query: KanbanRemoteQueryOptions = {
refetchInterval: 5_000,
refetchOnWindowFocus: true,
refetchOnReconnect: true,
retry: 2,
};
// Keep existing loaders: remote: { ...existingRemote, query }.

Indexed blocks validate every requested position and fixed total before caching, then hydrate only that block’s canonical slots. Append sequences advance by the actual short-page length, or one full window for an empty authoritative page. Returned totals take precedence over continuation flags; explicit flags otherwise take precedence over configured totals. Native refetch restarts retained pages from their first offset and recomputes later offsets; explicit refreshRemote() resets to page zero and forces a fresh read even with staleTime: Infinity or 'static' and refetchOnMount: false. Retrying an indexed slot reuses its mounted observer; recovering one slot preserves errors in other slots so they remain retryable. Automatic updates retain the current history stack and do not add a local edit entry; returned server cards are authoritative for the loaded positions.

Destroying/disabling/replacing a board’s read scope or adopting an external source releases its observers. Cancelling one board leaves a shared peer’s request alive; last-subscriber cancellation aborts the transport and settles callers even when a loader ignores abort. After all boards are destroyed, dispose application-owned contexts. Remote reads cannot be combined with built-in persistence; that adapter requires a complete canonical dataset. See Kanban writes.

The browser’s built-in Query cache avoids an HTTP read. A cache inside your backend may avoid a database query. They have different owners and invalidation rules. query: false bypasses the browser read engine and its automatic retry/refetch policy; it does not control a backend cache.

See shared loading options, save changes and error recovery. See the Kanban API for exact types.