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

feat: add "no server side rendering" guard to protect routes that should not be rendered in SSR #1277

Merged
merged 2 commits into from
Sep 21, 2022

Conversation

shauke
Copy link
Collaborator

@shauke shauke commented Sep 16, 2022

  • used for the checkout receipt page that should only be rendered in the users browser

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

…ot be rendered in SSR

* used for the checkout receipt page that should only be rendered in the users browser
@shauke shauke added this to the 3.1 milestone Sep 16, 2022
@shauke shauke self-assigned this Sep 16, 2022
@shauke shauke added the enhancement Enhancement to an existing feature label Sep 16, 2022
MaxKless
MaxKless previously approved these changes Sep 16, 2022
jometzner
jometzner previously approved these changes Sep 17, 2022
SGrueber
SGrueber previously approved these changes Sep 19, 2022
src/app/core/guards/server-side-rendering.guard.ts Outdated Show resolved Hide resolved
src/app/pages/checkout/checkout-page.module.ts Outdated Show resolved Hide resolved
@shauke shauke dismissed stale reviews from SGrueber, jometzner, and MaxKless via fbe4cac September 21, 2022 09:07
@shauke shauke force-pushed the feature/server-side-rendering-guard branch from fbe4cac to 765a2cd Compare September 21, 2022 09:16
@shauke shauke changed the title feat: add server side rendering guard to protect routes that should not be rendered in SSR feat: add "no server side rendering" guard to protect routes that should not be rendered in SSR Sep 21, 2022
@shauke shauke merged commit e0cbc91 into develop Sep 21, 2022
@shauke shauke deleted the feature/server-side-rendering-guard branch September 21, 2022 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants