Skip to content

Commit

Permalink
Remove head hydration workaround (sveltejs#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
John Muhl authored and habibrosyad committed Aug 4, 2020
1 parent bf3a831 commit 3ec2d67
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"webpack-modules": "^1.0.0"
},
"peerDependencies": {
"svelte": "^3.5.0"
"svelte": "^3.17.3"
},
"scripts": {
"test": "mocha --opts mocha.opts",
Expand Down
10 changes: 0 additions & 10 deletions runtime/src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,6 @@ async function render(redirect: Redirect, branch: any[], props: any, page: Page)
};
props.notify = stores.page.notify;

// first load — remove SSR'd <head> contents
const start = document.querySelector('#sapper-head-start');
const end = document.querySelector('#sapper-head-end');

if (start && end) {
while (start.nextSibling !== end) detach(start.nextSibling);
detach(start);
detach(end);
}

root_component = new App({
target,
props,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/server/middleware/get_page_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export function get_page_handler(
.replace('%sapper.base%', () => `<base href="${req.baseUrl}/">`)
.replace('%sapper.scripts%', () => `<script${nonce_attr}>${script}</script>`)
.replace('%sapper.html%', () => html)
.replace('%sapper.head%', () => `<noscript id='sapper-head-start'></noscript>${head}<noscript id='sapper-head-end'></noscript>`)
.replace('%sapper.head%', () => head)
.replace('%sapper.styles%', () => styles);

res.statusCode = status;
Expand Down

0 comments on commit 3ec2d67

Please sign in to comment.