Variable: SuspenseRoot

Estimated reading time: less than 1 minute
const SuspenseRoot: object

The SuspenseRoot is a store that holds the state of all the suspense components rendered in the server.

This was previously a global object called SUSPENSE_ROOT, but it was moved out of the global scope to avoid many issues related to global state.

Type Declaration

autoScript

autoScript: boolean = true

If we should automatically stream SuspenseScript before the first suspense is rendered. If you disable this setting, you need to manually load the SuspenseScript in your HTML before any suspense is rendered. Otherwise, the suspense will not work.

Default

true

requestCounter

requestCounter: number = 1

This value is used (and incremented shortly after) when no requestId is provided for renderToStream

Default

1

requests

requests: Map<string | number, RequestData>

The requests map is a map of RequestId x SuspenseData containing the stream to write the HTML, the number of running promises and if the first suspense has already resolved.