From eeba467649157e0a78186d51bc70e6c473eb48cb Mon Sep 17 00:00:00 2001 From: HazelGrant Date: Fri, 20 Dec 2024 08:34:26 -0500 Subject: [PATCH] Moves instiation lines for optionFor handlers to optionForHandler function --- apps/dashboard/app/javascript/dynamic_forms.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/dashboard/app/javascript/dynamic_forms.js b/apps/dashboard/app/javascript/dynamic_forms.js index f989a9c85..301826dea 100644 --- a/apps/dashboard/app/javascript/dynamic_forms.js +++ b/apps/dashboard/app/javascript/dynamic_forms.js @@ -110,8 +110,6 @@ function snakeCaseWords(str) { function memorizeElements(elements) { elements.each((_i, ele) => { formTokens.push(mountainCaseWords(shortId(ele['id']))); - optionForHandlerCache[ele['id']] = []; - exclusiveOptionForHandlerCache[ele['id']] = []; }); }; @@ -545,8 +543,10 @@ function sharedOptionForHandler(causeId, targetId, optionForType) { let handlerCache = null; if (optionForType == 'optionFor') { + if (optionForHandlerCache[causeId] == undefined) optionForHandlerCache[causeId] = []; handlerCache = optionForHandlerCache; } else if (optionForType == 'exclusiveOptionFor') { + if (exclusiveOptionForHandlerCache[causeId] == undefined) exclusiveOptionForHandlerCache[causeId] = []; handlerCache = exclusiveOptionForHandlerCache; }