Skip to content

Commit

Permalink
only add markers to head elements in SSR with hydratable=true (svelte…
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed Jan 14, 2020
1 parent c97e8f8 commit 621333e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compiler/compile/render_ssr/handlers/Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function(node: Element, renderer: Renderer, options: RenderOption
}
});

if (options.head_id) {
if (options.hydratable && options.head_id) {
renderer.add_string(` data-svelte="${options.head_id}"`);
}

Expand Down
6 changes: 5 additions & 1 deletion src/compiler/compile/render_ssr/handlers/Title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { x } from 'code-red';
export default function(node: Title, renderer: Renderer, options: RenderOptions) {
renderer.push();

renderer.add_string(`<title data-svelte="${options.head_id}">`);
renderer.add_string('<title');
if (options.hydratable && options.head_id) {
renderer.add_string(` data-svelte="${options.head_id}"`);
}
renderer.add_string('>');

renderer.render(node.children, options);

Expand Down

0 comments on commit 621333e

Please sign in to comment.