-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only inject push/pop/$$props in SSR components when necessary (#…
- Loading branch information
1 parent
9084f17
commit d1f5d5d
Showing
11 changed files
with
31 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: only inject push/pop in SSR components when necessary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
packages/svelte/tests/snapshot/samples/bind-this/_expected/server/index.svelte.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import * as $ from "svelte/internal/server"; | ||
|
||
export default function Bind_this($$payload, $$props) { | ||
$.push(); | ||
export default function Bind_this($$payload) { | ||
$$payload.out += `<!--[-->`; | ||
Foo($$payload, {}); | ||
$$payload.out += `<!--]-->`; | ||
$.pop(); | ||
} |
5 changes: 1 addition & 4 deletions
5
...s/svelte/tests/snapshot/samples/dynamic-attributes-casing/_expected/server/main.svelte.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
import * as $ from "svelte/internal/server"; | ||
|
||
export default function Main($$payload, $$props) { | ||
$.push(); | ||
|
||
export default function Main($$payload) { | ||
// needs to be a snapshot test because jsdom does auto-correct the attribute casing | ||
let x = 'test'; | ||
let y = () => 'test'; | ||
|
||
$$payload.out += `<div${$.attr("foobar", x, false)}></div> <svg${$.attr("viewBox", x, false)}></svg> <custom-element${$.attr("foobar", x, false)}></custom-element> <div${$.attr("foobar", y(), false)}></div> <svg${$.attr("viewBox", y(), false)}></svg> <custom-element${$.attr("foobar", y(), false)}></custom-element>`; | ||
$.pop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
packages/svelte/tests/snapshot/samples/hello-world/_expected/server/index.svelte.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import * as $ from "svelte/internal/server"; | ||
|
||
export default function Hello_world($$payload, $$props) { | ||
$.push(); | ||
export default function Hello_world($$payload) { | ||
$$payload.out += `<h1>hello world</h1>`; | ||
$.pop(); | ||
} |
4 changes: 1 addition & 3 deletions
4
packages/svelte/tests/snapshot/samples/hmr/_expected/server/index.svelte.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import * as $ from "svelte/internal/server"; | ||
|
||
export default function Hmr($$payload, $$props) { | ||
$.push(); | ||
export default function Hmr($$payload) { | ||
$$payload.out += `<h1>hello world</h1>`; | ||
$.pop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
packages/svelte/tests/snapshot/samples/svelte-element/_expected/server/index.svelte.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
import * as $ from "svelte/internal/server"; | ||
|
||
export default function Svelte_element($$payload, $$props) { | ||
$.push(); | ||
|
||
let { tag = 'hr' } = $$props; | ||
|
||
$$payload.out += `<!--[-->`; | ||
if (tag) $.element($$payload, tag, () => {}, () => {}); | ||
$$payload.out += `<!--]-->`; | ||
$.pop(); | ||
} |