From 807e840712ecef9743e1e90cd3c594bde0c3555a Mon Sep 17 00:00:00 2001 From: Martin Schuster Date: Wed, 8 Jan 2020 23:00:11 +0100 Subject: [PATCH] perf: prevent multiple case evaluations --- src/builtin/tags/case.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtin/tags/case.ts b/src/builtin/tags/case.ts index f8d19b6d6c..14ea8b7e90 100644 --- a/src/builtin/tags/case.ts +++ b/src/builtin/tags/case.ts @@ -26,10 +26,10 @@ export default { render: function * (ctx: Context, hash: Hash, emitter: Emitter) { const r = this.liquid.renderer + const cond = yield new Expression(this.cond).value(ctx) for (let i = 0; i < this.cases.length; i++) { const branch = this.cases[i] const val = yield new Expression(branch.val).value(ctx) - const cond = yield new Expression(this.cond).value(ctx) if (val === cond) { yield r.renderTemplates(branch.templates, ctx, emitter) return