createReactiveStoreFromDataPublisher

function createReactiveStoreFromDataPublisher<TData>(
    config,
): ReactiveStreamStore<TData>;

Returns a ReactiveStreamStore given a data publisher.

The store will update its state with each message published to dataChannelName and notify all subscribers. When a message is published to errorChannelName, subscribers are notified so they can react to the error condition, but the last-known state is preserved. Triggering the abort signal disconnects the store from the data publisher.

Things to note:

  • getUnifiedState() starts in status: 'loading' until the first notification arrives.
  • On error, getUnifiedState().data continues to return the last known value and error holds the failure. Only the first error is captured.
  • The function returned by subscribe is idempotent — calling it multiple times is safe.
  • Because a DataPublisher instance cannot be restarted, `retry()` on the returned store throws a SOLANA_ERROR__SUBSCRIBABLE__RETRY_NOT_SUPPORTED | `SolanaError`.

Type Parameters

Type Parameter
TData

Parameters

ParameterTypeDescription
configConfig-

Returns

ReactiveStreamStore<TData>

Deprecated

Use createReactiveStoreFromDataPublisherFactory instead. That variant accepts a factory function for the underlying DataPublisher and can therefore support `retry()`.

On this page