Options
All
  • Public
  • Public/Protected
  • All
Menu

The Async SSR Manager enables the integrator to render a given composition of React Feature Apps in multiple render passes until all Feature Apps and Feature Services have finished their asynchronous operations.

The integrator should provide the Async SSR Manager only on the server.

Feature Apps and Feature Services should declare the Async SSR Manager as an optional dependency. Its presence can be used to determine whether they are currently rendered on the server or on the client.

Hierarchy

  • AsyncSsrManagerV1

Index

Methods

renderUntilCompleted

  • renderUntilCompleted(render: function): Promise<string>
  • This method is intended for the integrator. It calls the given render function at least once. With scheduleRerender further render passes can be triggered. It resolves with the result of the last render call.

    throws

    Throws an error when the configured timeout is reached (see [[AsyncSsrManagerConfig.timeout]]).

    Parameters

    • render: function

      A render function that is called for each render pass.

        • (): string
        • Returns string

    Returns Promise<string>

scheduleRerender

  • scheduleRerender(asyncOperation?: Promise<unknown>): void
  • This method is intended for consumers, i.e. Feature Apps and Feature Services. It schedules a rerender with an optional promise representing an asynchronous operation. The method must be called synchronously during a render pass, or while already scheduled asynchronous operations are running.

    If no asynchronous operation is running, the method must be called synchronously during a render pass. This means that the following will not work:

    const data = await fetch('example.com').then(res => res.json());
    // the rerender scheduled in the next line is not taken into account
    asyncSsrManager.scheduleRerender();

    Instead, the rerender should be scheduled before awaiting the asynchronous operation:

    const dataPromise = fetch('example.com').then(res => res.json());
    asyncSsrManager.scheduleRerender(dataPromise);
    const data = await dataPromise;

    Calling it while already scheduled asynchronous operations are running, does not lead to multiple render passes, but instead the already scheduled rerender is deferred until every registered asynchronous operation has finished.

    Parameters

    • Optional asyncOperation: Promise<unknown>

      A promise representing an asynchronous operation that shall defer the scheduled rerender at least until after its completion.

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc