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

WIP: fix duplicate get store value #4195

Conversation

tanhauhau
Copy link
Member

Fix #3375

@Conduitry
Copy link
Member

Did you see the couple of failing tests related to SSR?

@tanhauhau
Copy link
Member Author

yea... i havent figured out why...

@tanhauhau tanhauhau changed the title fix duplicate get store value WIP: fix duplicate get store value Jan 2, 2020
@ghost
Copy link

ghost commented Jan 8, 2020

Hmm, seems the $foo = get_store_value$(foo) is in the wrong spot for SSR code.
It seems like we need to first check if there are store references on the RHS of assignment statements in instance_javascript.

So, we need the main.js code to look like:

	let $foo;
	let foo = writable(42);
-	let { initial_foo = $foo } = $$props;
+	let { initial_foo = $foo = get_store_value$(foo)} = $$props;
	if ($$props.initial_foo === void 0 && $$bindings.initial_foo && initial_foo !== void 0) $$bindings.initial_foo(initial_foo);
-	$foo = get_store_value$(foo);
	return `<p>${escape$(initial_foo)}</p>`;

However, I'm not sure how this will behave with the alternate generator for the main block which loops until settled.

@Conduitry Conduitry marked this pull request as draft April 29, 2020 21:24
@Conduitry Conduitry mentioned this pull request Sep 18, 2020
4 tasks
@Conduitry
Copy link
Member

Closing in favor of #5419.

@Conduitry Conduitry closed this Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_store_value() called twice in SSR mode
2 participants