From e0c4273acf6d28f4a64203d3df6327b40041a82a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 3 Sep 2024 19:56:32 +0100 Subject: [PATCH] Don't wait for things we don't care about --- .../builder/src/stores/builder/rowActions.js | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/stores/builder/rowActions.js b/packages/builder/src/stores/builder/rowActions.js index 58a207bb2e..e91ca9bbef 100644 --- a/packages/builder/src/stores/builder/rowActions.js +++ b/packages/builder/src/stores/builder/rowActions.js @@ -48,24 +48,20 @@ export class RowActionStore extends BudiStore { getName: x => x.name, }) - // Create the action and update state + // Create the action const res = await API.rowActions.create({ name, tableId, }) - this.update(state => ({ - ...state, - [tableId]: [...(state[tableId] || []), res], - })) - // If adding to a view, enable on this view + // Enable action on this view if adding via a view if (viewId) { await this.enableView(tableId, viewId, res.id) + } else { + await this.refreshRowActions(tableId) } - // Refresh automations so we have this new row action automation - await automationStore.actions.fetch() - + automationStore.actions.fetch() return res } @@ -93,10 +89,8 @@ export class RowActionStore extends BudiStore { rowActionId, name, }) - await Promise.all([ - this.refreshRowActions(tableId), - automationStore.actions.fetch(), - ]) + await this.refreshRowActions(tableId) + automationStore.actions.fetch() } delete = async (tableId, rowActionId) => {