Skip to content

makeSingleTabAdapter

makeSingleTabAdapter(options): Adapter

Defined in: packages/@livestore/adapter-web/src/single-tab/single-tab-adapter.ts:145

Creates a single-tab web adapter with OPFS persistence.

This adapter is a fallback for browsers without SharedWorker support (notably Android Chrome). It provides the same persistence capabilities as makePersistedAdapter, but without multi-tab synchronization. Each browser tab runs its own independent leader worker.

In most cases, you should use makePersistedAdapter instead, which automatically falls back to this adapter when SharedWorker is unavailable.

Limitations:

  • No multi-tab synchronization (each tab operates independently)
  • No devtools support (requires SharedWorker)
  • Opening multiple tabs with the same storeId may cause data conflicts

SingleTabAdapterOptions

Adapter

import { makeSingleTabAdapter } from '@livestore/adapter-web'
import LiveStoreWorker from './livestore.worker.ts?worker'
// Only use this directly if you specifically need single-tab mode.
// Prefer makePersistedAdapter which auto-detects SharedWorker support.
const adapter = makeSingleTabAdapter({
worker: LiveStoreWorker,
storage: { type: 'opfs' },
})