React Executor - v0.0.26
    Preparing search index...

    Class SSRExecutorManager

    The base implementation of the executor manager that supports client hydration after SSR.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _executorPredicate: (executor: Executor) => boolean

    Predicate that executors must satisfy to be hydrated on the client with the state accumulated during SSR.

    _executors: Map<unknown, ExecutorImpl<any>> = ...

    The map from a key to an executor.

    _hydratedVersions: WeakMap<Executor<any>, number> = ...

    Map from an executor to a version of the state that was sent to the client for hydration.

    _initialState: Map<unknown, ExecutorState<any>> = ...

    The map from a key ID to an initial state that must be set to an executor before plugins are applied. Entries from this map are deleted after the executor is created.

    _plugins: ExecutorPlugin[] = []

    Plugins that are applied to all executors.

    _pubSub: PubSub<ExecutorEvent<any>> = ...

    The pubsub that handles the manager subscriptions.

    _serializer: Serializer | JSON

    Stringifies executor keys and state snapshots before sending them to the client.

    keyIdGenerator: (key: unknown) => unknown

    Returns the unique comparable ID for the executor key.

    nonce: undefined | string

    A nonce string to allow hydration scripts under a script-src Content-Security-Policy.

    Methods

    • Instantly aborts all pending executors and preserves their available results as is.

      Parameters

      • Optionalreason: unknown

        The abort reason that is used for rejection of the pending task promises.

      Returns void

    • Deletes the non-active executor from the manager.

      If the detached executor is pending then it is not aborted. Subscribe to the detach event on either manager or an executor and abort it manually.

      Parameters

      • key: unknown

        The key of the executor to delete.

      Returns boolean

      true if the executor was detached, or false if there's no such executor, or the executor is active.

    • Returns an executor by its key, or undefined if there's no such executor.

      Parameters

      • key: unknown

        The unique executor key.

      Returns undefined | Executor<any>

    • Injects the initial state for the executor that can be created in the future.

      Parameters

      Returns boolean

      true if the executor has been hydrated, or false if the executor has already been created and therefore cannot be hydrated.

    • Returns an inline <script> tag with source that hydrates the client with the state accumulated during SSR, or an empty string if there are no state changes since the last time nextHydrationScriptSource was called.

      Returns string

    • Returns a script source that hydrates the client with the state accumulated during SSR, or an empty string if there are no state changes since the last time nextHydrationScriptSource was called.

      Returns string

    • Subscribes a listener to the events published by all executors that are created by this manager.

      Parameters

      • listener: (event: ExecutorEvent) => void

        The listener to subscribe.

      Returns () => void

      The callback that unsubscribes the listener.