Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move onCompleteAll to .allReady Promise #24025

Merged
merged 2 commits into from
Mar 3, 2022

Commits on Mar 3, 2022

  1. Move onCompleteAll to .allReady Promise

    The onCompleteAll callback can sometimes resolve before the promise that
    returns the stream which is tough to coordinate. A more idiomatic API
    for a one shot event is a Promise.
    
    That way the way you render for SEO or SSG is:
    
    const stream = await renderToReadableStream(...);
    await stream.readyAll;
    respondWith(stream);
    
    Ideally this should be a sub-class of ReadableStream but we don't yet
    compile these to ES6 and they'd had to be to native class to subclass
    a native stream.
    
    I have other ideas for overriding the .tee() method in a subclass anyway.
    So this is inline with that strategy.
    sebmarkbage committed Mar 3, 2022
    Configuration menu
    Copy the full SHA
    ef35e50 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5cb2074 View commit details
    Browse the repository at this point in the history