Documentation / @warp-drive/core / reactive / getExpensiveRequestSubscription
Function: getExpensiveRequestSubscription()
function getExpensiveRequestSubscription(
store,
requestKey,
callback): () => void;
Defined in: warp-drive-packages/core/src/store/-private/new-core-tmp/expensive-subscription.ts:128
Creates an ExpensiveSubscription for the RequestKey if one does not already exist and adds a watcher to it.
Returns a cleanup function. This should be called on-mount by a component that wants to subscribe to a request and cleanup should be called on dismount.
⚠️ Avoid Using If Your App Supports Fine-grained Reactivity
This mechanism should never be used by frameworks or libraries that support fine-grained reactivity.
ExpensiveSubscription
is a mechanism for non-reactive frameworks such as react
to integrate with WarpDrive, for instance by treating a request as an external store
ExpensiveSubscription
is expensive because it doubles the number of notification callbacks required for each resource contained in the request being subscribed to. The more requests in-use, the more this cost adds up.
Parameters
store
requestKey
callback
() => void
Returns
(): void;
Returns
void