Title: Hydration: detect when index.html is altered between the server and the client · Issue #51160 · angular/angular · GitHub
Open Graph Title: Hydration: detect when index.html is altered between the server and the client · Issue #51160 · angular/angular
X Title: Hydration: detect when index.html is altered between the server and the client · Issue #51160 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? core Description The non-destructive hydration expects the DOM tree to have the same structure in both places. This also includes whitespaces and comment nodes that...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? core Description The non-destructive hydration expects the DOM tree to have the same structure in both places. This also inc...
X Description: Which @angular/* package(s) are relevant/related to the feature request? core Description The non-destructive hydration expects the DOM tree to have the same structure in both places. This also inc...
Opengraph URL: https://github.com/angular/angular/issues/51160
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Hydration: detect when index.html is altered between the server and the client","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\ncore\r\n\r\n### Description\r\n\r\nThe non-destructive hydration expects the DOM tree to have the same structure in both places. This also includes whitespaces and comment nodes that Angular produces during the rendering on the server. Those whitespaces and nodes must be present in the HTML generated by the server-side rendering process. This is also documented at: https://angular.io/guide/hydration#constraints.\r\n\r\nIn practice, some CDNs ([example](https://developers.cloudflare.com/speed/optimization/content/auto-minify/)) have mechanisms to remove all comment nodes and spaces from all text nodes from HTML while serving the content (there are also cases where this type of optimization is performed at the build step). Those mechanisms are frequently enabled by default. This leads to situations where an application worked in dev mode correctly, but started failing in production. Since the production code is also minified, it makes it hard to look at the stack trace and identify the origin of the problem.\r\n\r\nThis feature requests proposes that we add a special detection mechanism for such cases. For example, we can do the following:\r\n\r\n- on the server, while serializing DOM, add a comment node to a well known location (e.g. as a first node in the `\u003cbody>`)\r\n- on the client (both in dev and prod modes), before starting hydration process, verify the presence of those \"marker\" nodes and throw an error if they are not present\r\n- we should also add an error guide for this error, so that the link to the guide is present in production mode\r\n\r\nOne of the examples where this issue becomes a hard-to-debug problem: https://github.com/angular/angular/issues/50133#issuecomment-1535713053","author":{"url":"https://github.com/AndrewKushnir","@type":"Person","name":"AndrewKushnir"},"datePublished":"2023-07-24T22:01:20Z","url":"https://github.com/angular/angular/issues/51160"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:22a897b0-a224-2069-4dfe-04d7e2470ad5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D104:1F7384:14351EB:1AB6BA3:6B01254F |
| html-safe-nonce | b74c2ddd27aed3b04c498174c91bdc7acaf9be86e627fcc615a227fa23fdd3eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTA0OjFGNzM4NDoxNDM1MUVCOjFBQjZCQTM6NkIwMTI1NEYiLCJ2aXNpdG9yX2lkIjoiMTQ2NzI5MjA3NTcxOTQ2ODM2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0854ecfd176c1adfa165292f76020a597ee560ea5b673cf63fa8e0d22b148fde |
| hovercard-subject-tag | issue:1819208999 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/51160/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b1bd06d8ec094272f997f4b499b7e51af4e408b4fb13d7964468e0851b9d7f21/angular/angular/issues/51160 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b1bd06d8ec094272f997f4b499b7e51af4e408b4fb13d7964468e0851b9d7f21/angular/angular/issues/51160 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? core Description The non-destructive hydration expects the DOM tree to have the same structure in both places. This also inc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AndrewKushnir |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width