fix bindings in ssr

pull/1367/head
Rich Harris 7 years ago
parent c06bfdbe35
commit a641019ab9

@ -25,11 +25,11 @@ export default function visitAwaitBlock(
visit(generator, childBlock, child); visit(generator, childBlock, child);
}); });
generator.append('`; return `'); generator.append('`; return function(ctx) { return `');
node.then.children.forEach((child: Node) => { node.then.children.forEach((child: Node) => {
visit(generator, childBlock, child); visit(generator, childBlock, child);
}); });
generator.append(`\`;}(${snippet})) }`); generator.append(`\`;}(Object.assign({}, ctx, { ${node.value}: __value }));}(${snippet})) }`);
} }

@ -22,15 +22,12 @@ export default function visitComponent(
} }
const bindingProps = node.bindings.map(binding => { const bindingProps = node.bindings.map(binding => {
const { name } = getObject(binding.value); const { name } = getObject(binding.value.node);
const tail = binding.value.type === 'MemberExpression' const tail = binding.value.node.type === 'MemberExpression'
? getTailSnippet(binding.value) ? getTailSnippet(binding.value.node)
: ''; : '';
const keypath = block.contexts.has(name) return `${binding.name}: ctx.${name}${tail}`;
? `${name}${tail}`
: `ctx.${name}${tail}`;
return `${binding.name}: ${keypath}`;
}); });
function getAttributeValue(attribute) { function getAttributeValue(attribute) {

Loading…
Cancel
Save