From a64a8177eb6fb532e1c6c9b258c70b5f3d2816aa Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 29 Jan 2021 15:36:53 +0100 Subject: [PATCH] Repair error caused by collecting fields too early in during --- packages/compiler/src/compiler/codegen.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/compiler/src/compiler/codegen.ts b/packages/compiler/src/compiler/codegen.ts index 7290fff..6f0ce10 100644 --- a/packages/compiler/src/compiler/codegen.ts +++ b/packages/compiler/src/compiler/codegen.ts @@ -198,13 +198,12 @@ export function expand(tree: Items, ctx: ExpansionContext): Items { } else { // TODO: untyped template const sa = compilePattern(s.pattern); - const body = ctx.withCollectedFields(s.facetFields, () => walk(s.body)); return t`withSelfDo(function (thisFacet) { const _Facets = new __SYNDICATE__.Dictionary<__SYNDICATE__.Facet>(); on asserted ${patternText(s.pattern)} => react { _Facets.set([${commaJoin(sa.captureBinders.map(t=>[t.id]))}], thisFacet); dataflow { } // TODO: horrible hack to keep the facet alive if no other endpoints - ${body} + ${s.body} } on retracted ${patternText(s.pattern)} => { const _Key = [${commaJoin(sa.captureBinders.map(t=>[t.id]))}];