feat: add "no server side rendering" guard to protect routes that should not be rendered in SSR #1277
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Type
[x] Feature
What Is the Current Behavior?
Currently the checkout receipt page is not protected by any guard. It is rendered on the server side as well as on the browser side. Since some information is missing on the server side, e.g. authentication (apiToken cookie) and user information, the needed data cannot be fetched and only an empty page can be rendered.
With the relatively simple logic of the standard checkout receipt page this is not a big problem and the page is rendered as a more or less empty page without errors in SSR and returned to the browser that will than render the page with the full content since here the needed user authentication is available.
In projects though it can happen that more information is handled for this page and it can happen that this is not implemented in a SSR safe way resulting in errors or timeouts.
What Is the New Behavior?
With the introduced
NoServerSideRenderingGuard
it is now possible to protect certain routes from being rendered at all in SSR and instead returning a simple loading animation page. Back in the browser this page will then be completely rendered without problems.This functionality is used to protect all checkout pages from being rendered in SSR.
Does this PR Introduce a Breaking Change?
[x] No
Other Information
AB#79644