From 3839e26758bdc4e090d4d514a1c5fc1cb8c5f908 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 15 Sep 2023 09:06:40 +0100 Subject: [PATCH] Make all actions globally aware in component settings --- .../builder/src/builderStore/dataBinding.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index c0e8109252..5138b21479 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -261,17 +261,16 @@ export const getComponentContexts = ( * Gets all data provider components above a component. */ export const getActionProviderComponents = (asset, componentId, actionType) => { - if (!asset || !componentId) { + if (!asset) { return [] } - - // Get the component tree leading up to this component, ignoring the component - // itself - const path = findComponentPath(asset.props, componentId) - path.pop() - - // Filter by only data provider components - return path.filter(component => { + const components = findAllComponents(asset.props) + return components.filter(component => { + // Ignore ourselves + if (componentId && component._id === componentId) { + return false + } + // Find components when expose this action const def = store.actions.components.getDefinition(component._component) return def?.actions?.includes(actionType) })