From 37b1bc45cfe6661dc74dfc669b1e4cd75e9a7315 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 24 May 2024 10:34:58 +0100 Subject: [PATCH] Move stuff around to remove need for code hoisting --- .../backend/DataTable/modals/OptionsEditor.svelte | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/OptionsEditor.svelte b/packages/builder/src/components/backend/DataTable/modals/OptionsEditor.svelte index 7e02ea422e..033c50e3d5 100644 --- a/packages/builder/src/components/backend/DataTable/modals/OptionsEditor.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/OptionsEditor.svelte @@ -12,10 +12,8 @@ const flipDurationMs = 130 const { OptionColours } = Constants - - let openOption = null - let anchor = null - let options = writable( + const getDefaultColor = idx => OptionColours[idx % OptionColours.length] + const options = writable( constraints.inclusion.map((value, idx) => ({ id: Math.random(), name: value, @@ -24,6 +22,9 @@ })) ) + let openOption = null + let anchor = null + $: options.subscribe(updateConstraints) const updateConstraints = options => { @@ -34,10 +35,6 @@ ) } - const getDefaultColor = idx => { - return OptionColours[idx % OptionColours.length] - } - const addNewInput = async () => { const newId = Math.random() const newName = getSequentialName($options, "Option ", {