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

Context variable overrides shared helper when hydratable: true #1229

Closed
mrkishi opened this issue Mar 12, 2018 · 0 comments · Fixed by #1231
Closed

Context variable overrides shared helper when hydratable: true #1229

mrkishi opened this issue Mar 12, 2018 · 0 comments · Fixed by #1231
Labels

Comments

@mrkishi
Copy link
Member

mrkishi commented Mar 12, 2018

It seems having keys with the same name as shared helpers can cause problems in v1.57 SSR.

eg. This runs fine on the repl, but will error when SSRing because claim will try to call children:

https://svelte.technology/repl?version=1.57.0&gist=9a26ffaad3e8741640d51c55c1600ead

// (1:0) {{#if children}}
function create_if_block(component, state) {
	var ul;

	var children = state.children;

	var each_blocks = [];

	for (var i = 0; i < children.length; i += 1) {
		each_blocks[i] = create_each_block(component, assign({}, state, {
			children: children,
			child: children[i],
			child_index: i
		}));
	}

	return {
		c: function create() {
			ul = createElement("ul");

			for (var i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].c();
			}
		},

		l: function claim(nodes) {
			ul = claimElement(nodes, "UL", {}, false);
			var ul_nodes = children(ul); // <- children is not a function

			for (var i = 0; i < each_blocks.length; i += 1) {
				each_blocks[i].l(ul_nodes);
			}

			ul_nodes.forEach(detachNode);
		},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants