Make all actions globally aware in component settings

This commit is contained in:
Andrew Kingston 2023-09-15 09:06:40 +01:00
parent 429f2e0c5f
commit 3839e26758
1 changed files with 8 additions and 9 deletions

View File

@ -261,17 +261,16 @@ export const getComponentContexts = (
* Gets all data provider components above a component. * Gets all data provider components above a component.
*/ */
export const getActionProviderComponents = (asset, componentId, actionType) => { export const getActionProviderComponents = (asset, componentId, actionType) => {
if (!asset || !componentId) { if (!asset) {
return [] return []
} }
const components = findAllComponents(asset.props)
// Get the component tree leading up to this component, ignoring the component return components.filter(component => {
// itself // Ignore ourselves
const path = findComponentPath(asset.props, componentId) if (componentId && component._id === componentId) {
path.pop() return false
}
// Filter by only data provider components // Find components when expose this action
return path.filter(component => {
const def = store.actions.components.getDefinition(component._component) const def = store.actions.components.getDefinition(component._component)
return def?.actions?.includes(actionType) return def?.actions?.includes(actionType)
}) })