From ed371df6fde17e6f72d251e6fcf9ab53542fc159 Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Thu, 27 May 2021 07:43:47 -0700 Subject: [PATCH] Ensure hash works with custom tags We need to make sure references exist before we attempt to get their value and track them. --- packages/@glimmer/runtime/lib/helpers/hash.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/@glimmer/runtime/lib/helpers/hash.ts b/packages/@glimmer/runtime/lib/helpers/hash.ts index 4216f1570d..ed750d6c7e 100644 --- a/packages/@glimmer/runtime/lib/helpers/hash.ts +++ b/packages/@glimmer/runtime/lib/helpers/hash.ts @@ -6,8 +6,12 @@ import { combine, Tag, tagFor, track } from '@glimmer/validator'; import { deprecate } from '@glimmer/global-context'; import { internalHelper } from './internal-helper'; -function tagForKey(hash: CapturedNamedArguments, key: string): Tag { - return track(() => valueForRef(hash[key])); +function tagForKey(namedArgs: CapturedNamedArguments, key: string): Tag { + return track(() => { + if (key in namedArgs) { + valueForRef(namedArgs[key]); + } + }); } let hashProxyFor: (args: CapturedNamedArguments) => Record;