From e25862fa03d6d1259202eaef50492efeb19c7953 Mon Sep 17 00:00:00 2001 From: Nils Lundquist Date: Thu, 4 Jul 2019 16:51:25 -0600 Subject: [PATCH] change to check if the scope already has a let scope before adding one --- can-stache.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/can-stache.js b/can-stache.js index 5bcafc16..3df88e83 100644 --- a/can-stache.js +++ b/can-stache.js @@ -543,7 +543,12 @@ function stache (filename, template) { scope._parent = templateContextScope; } - return renderer(scope.addLetContext(), nodeList); + // add let context if passed scope doesn't already have one + if (!scope.getScope(function(s) {return s._meta.variable === true;})) { + scope = scope.addLetContext(); + } + + return renderer(scope, nodeList); }); // Identify is a view type