From 7901c2d4ac9cad004b812d57652b35d44ea4ae81 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 23 Oct 2024 16:37:46 +0200 Subject: [PATCH] Remove builderData usage --- .../AutomationPanel/AutomationNavItem.svelte | 2 +- .../AutomationPanel/AutomationPanel.svelte | 10 ++-------- packages/builder/src/stores/builder/automations.js | 14 -------------- packages/builder/src/stores/builder/index.js | 2 -- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte index 50814897b4..4e9ca5fd53 100644 --- a/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationNavItem.svelte @@ -112,7 +112,7 @@ iconColor={automation.disabled ? "var(--spectrum-global-color-gray-600)" : "var(--spectrum-global-color-gray-900)"} - text={automation.displayName} + text={automation.name} selected={automation._id === $selectedAutomation?._id} hovering={automation._id === $contextMenuStore.id} on:click={() => automationStore.actions.select(automation._id)} diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationPanel.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationPanel.svelte index 6b96c4ebf5..a26efdf243 100644 --- a/packages/builder/src/components/automation/AutomationPanel/AutomationPanel.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationPanel.svelte @@ -25,15 +25,9 @@ automation.name.toLowerCase().includes(searchString.toLowerCase()) ) }) - .map(automation => ({ - ...automation, - displayName: - $automationStore.automationDisplayData[automation._id]?.displayName || - automation.name, - })) .sort((a, b) => { - const lowerA = a.displayName.toLowerCase() - const lowerB = b.displayName.toLowerCase() + const lowerA = a.name.toLowerCase() + const lowerB = b.name.toLowerCase() return lowerA > lowerB ? 1 : -1 }) diff --git a/packages/builder/src/stores/builder/automations.js b/packages/builder/src/stores/builder/automations.js index b8765ad1e7..bb0f5d2085 100644 --- a/packages/builder/src/stores/builder/automations.js +++ b/packages/builder/src/stores/builder/automations.js @@ -23,7 +23,6 @@ const initialAutomationState = { ACTION: {}, }, selectedAutomationId: null, - automationDisplayData: {}, } // If this functions, remove the actions elements @@ -91,7 +90,6 @@ const automationActions = store => ({ state.automations.sort((a, b) => { return a.name < b.name ? -1 : 1 }) - state.automationDisplayData = automationResponse.builderData state.blockDefinitions = getFinalDefinitions( definitions.trigger, definitions.action @@ -153,8 +151,6 @@ const automationActions = store => ({ state.selectedAutomationId = state.automations[0]?._id || null } - // Clear out automationDisplayData for the automation - delete state.automationDisplayData[automation._id] return state }) }, @@ -432,13 +428,3 @@ export const selectedAutomation = derived(automationStore, $automationStore => { x => x._id === $automationStore.selectedAutomationId ) }) - -export const selectedAutomationDisplayData = derived( - [automationStore, selectedAutomation], - ([$automationStore, $selectedAutomation]) => { - if (!$selectedAutomation?._id) { - return null - } - return $automationStore.automationDisplayData[$selectedAutomation._id] - } -) diff --git a/packages/builder/src/stores/builder/index.js b/packages/builder/src/stores/builder/index.js index dbde739951..158cd29973 100644 --- a/packages/builder/src/stores/builder/index.js +++ b/packages/builder/src/stores/builder/index.js @@ -11,7 +11,6 @@ import { automationStore, selectedAutomation, automationHistoryStore, - selectedAutomationDisplayData, } from "./automations.js" import { userStore, userSelectedResourceMap, isOnlyUser } from "./users.js" import { deploymentStore } from "./deployments.js" @@ -46,7 +45,6 @@ export { previewStore, automationStore, selectedAutomation, - selectedAutomationDisplayData, automationHistoryStore, sortedScreens, userStore,