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

Can't serialize circular values #2135

Closed
Rich-Harris opened this issue Feb 26, 2019 · 0 comments · Fixed by #3146
Closed

Can't serialize circular values #2135

Rich-Harris opened this issue Feb 26, 2019 · 0 comments · Fixed by #3146
Labels

Comments

@Rich-Harris
Copy link
Member

REPL. This (admittedly somewhat rare) case fails in SSR, because it tries to do JSON.stringify(circular):

<script>
	let circular = {};
	circular.self = circular;
</script>

<select bind:value={circular}>
	<option value={circular}>wheeee</option>
</select>
/* App.svelte generated by Svelte v3.0.0-beta.8 */
import { create_ssr_component, escape } from "svelte/internal";

const App = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
	let circular = {};
	circular.self = circular;

	return `<select ${(v => v ? ("value" + (v === true ? "" : "=" + JSON.stringify(v))) : "")(circular)}>
		<option${(v => v == null ? "" : ` value="${escape(circular)}"`)(circular)}>wheeee</option>
	</select>`;
});

export default App;
@Rich-Harris Rich-Harris added this to the 3.x milestone Mar 17, 2019
Rich-Harris added a commit that referenced this issue Jul 1, 2019
handle circular values when rendering bindings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant