Skip to content

Commit

Permalink
Allow command context to be an array to allow same commands to be loa…
Browse files Browse the repository at this point in the history
…ded in multiple contexts
  • Loading branch information
glendaviesnz committed Oct 13, 2023
1 parent ef21f20 commit 9bc932a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/commands/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export const getCommandLoaders = createSelector(
( state, contextual = false ) =>
Object.values( state.commandLoaders ).filter( ( loader ) => {
const isContextual =
loader.context && loader.context === state.context;
loader.context && Array.isArray( loader.context )
? loader.context.includes( state.context )
: loader.context && loader.context === state.context;
return contextual ? isContextual : ! isContextual;
} ),
( state ) => [ state.commandLoaders, state.context ]
Expand Down

0 comments on commit 9bc932a

Please sign in to comment.