Skip to content

feat(react/ssr): add StringRenderer and some refactoring#411

Open
alvaromateo wants to merge 10 commits intomainfrom
ssr
Open

feat(react/ssr): add StringRenderer and some refactoring#411
alvaromateo wants to merge 10 commits intomainfrom
ssr

Conversation

@alvaromateo
Copy link

Done

This PR introduces some features and breaking changes in packages/react/ssr.

  • Refactor of the render code to include a Base class from which to extend depending on the type of render.
  • Add a render method that uses non-streaming SSR.
  • Add the possibility to pass initial data to the entry point.

It also fixes the following issues:

  • Fix Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client error in apps/react/demo when running it in production mode (bun run serve)
  • Adapted apps/react/demo to the changes done in the SSR module.
  • Adapted apps/react/boilerplate-vite to the changes done in the SSR module.

In the demo website I have removed:

  • Tanstack Router: it uses its own rendering logic (renderRouterToString & renderRouterToStream), so if we want to demo the react/ssr code we can't use it.
  • The react-shadow component: these can not be rendered in the server side, as their API is only available in the browser. When running the demo in production mode the server crashes when it tries to render shadow components.

QA

  • Clone this branch in your local computer
  • bun install
  • cd apps/react/demo
  • bun run dev and check that the website works
  • bun run serve and check that the website works
  • cd ../boilerplate-vite
  • bun run dev and check that the website works
  • bun run serve and check that the website works

PR readiness check

  • PR should have one of the following labels:
    • Feature 🎁, Breaking Change 💣, Bug 🐛, Documentation 📝, Maintenance 🔨.
  • PR title follows the Conventional Commits format.
  • All packages define the required scripts in package.json:
    • All packages: check, check:fix, and test.
    • Packages with build steps: build to build the package for development or distribution, build:all to build all artifacts. See CONTRIBUTING.md for details.

NOTE

I've increased the major version of the packages I've modified. Please let me know if this is the correct approach or if I need to increase the version of all packages to keep them in sync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant