Skip to main content
Solid Relay

Function: createSubscriptionToInvalidationState()

createSubscriptionToInvalidationState(dataIDs, callback): Disposable

Defined in: dist/index.d.mts:273

Subscribes a callback to the invalidation state of the given data IDs.

Any time the invalidation state of the given data IDs changes (either one of the records or the whole store gets invalidated), the provided callback is called. When the data IDs (or the environment) change, the subscription is re-established and the previous one is disposed. The subscription is automatically disposed on cleanup.

The callback may be given directly or through an accessor. Since a zero-argument callback and an accessor are indistinguishable at runtime, the value is resolved when an invalidation happens: callback is invoked, and if it returns a function, that function is invoked as the actual callback. The accessor is read untracked, so changing it never re-establishes the subscription.

Parameters

dataIDs

MaybeAccessor<readonly string[]>

Data IDs to observe, or an accessor returning them.

callback

MaybeAccessor<() => void>

Called whenever the invalidation state of the data IDs changes, or an accessor returning such a callback.

Returns

Disposable

A disposable that can be used to stop the subscription early.

Solid RelaySolidJS Bindings for Relay
Community
github