renderToStreamWithSuspenseScoped function

Stream<String> renderToStreamWithSuspenseScoped(
  1. BloomNode node, {
  2. BloomQueryScope? scope,
  3. String? debugLabel,
})

Owned-scope suspense streaming: creates a request scope if the caller is not already scoped, and disposes it when the stream closes/errors/cancels.

Implementation

Stream<String> renderToStreamWithSuspenseScoped(
  BloomNode node, {
  BloomQueryScope? scope,
  String? debugLabel,
}) {
  final ambient = scope ?? BloomData.currentScopeOrNull;
  if (ambient != null) {
    return renderToStreamWithSuspenseInScope(node, ambient);
  }
  return runSsrRequestStream(
    (owned) => renderToStreamWithSuspenseInScope(node, owned),
    debugLabel: debugLabel ?? 'ssr-stream',
  );
}