Hide selection-type args from command palette while in an edit flow (#5763)

* Allow `hidden` config to be a callback

* Hide selection type args if `nodeToEdit` is present

in workflows that have an edit flow set up

* Remove Selection from headerArguments in edit flow tests
This commit is contained in:
Frank Noirot
2025-03-11 16:29:03 -04:00
committed by GitHub
parent b5028f7aa8
commit 724e65ac97
5 changed files with 31 additions and 8 deletions

View File

@ -17,7 +17,12 @@ function CommandBarHeader({ children }: React.PropsWithChildren<{}>) {
if (!selectedCommand?.args) return undefined
const s = { ...selectedCommand.args }
for (const [name, arg] of Object.entries(s)) {
if (arg.hidden) delete s[name]
if (
typeof arg.hidden === 'function'
? arg.hidden(commandBarState.context)
: arg.hidden
)
delete s[name]
}
return s
}, [selectedCommand])