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

Version Packages #1057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Version Packages #1057

wants to merge 1 commit into from

Conversation

seek-oss-ci
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to master, this PR will be updated.

Releases

[email protected]

Minor Changes

  • Add experimental renderToStringAsync parameter in renderApp (#1050)

    The new renderToStringAsync method can be called instead of React DOM's renderToString. It is an asynchronous function, but once awaited should return the same result.

    This new function won't error when hitting suspended components during a static render, instead it'll wait for all suspended boundaries to resolve.

    Note: react-dom is now an optional peer dependency for use in this function. All known uses of static rendering use react-dom and shouldn't need to make a change.

    The function is being provided to enable teams to trial the behaviour, but is not encouraged for production use.

    -import { renderToString } from 'react-dom/server';
    
    const skuRender: Render<RenderContext> = {
    -  renderApp: ({ SkuProvider, environment }) => {
    +  renderApp: async ({ SkuProvider, environment, renderToStringAsync }) => {
    -    const appHtml = renderToString(
    +    const appHtml = await renderToStringAsync(
          <SkuProvider>
            <App environment={environment as ClientContext['environment']} />
          </SkuProvider>,
        );
    
        return {
          appHtml,
        };
      },
      // ...
    };

    This new feature is experimental, and is likely to change in implementation or may be removed completely.

@seek-oss-ci seek-oss-ci requested a review from a team as a code owner September 20, 2024 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant