Make commands disable, not unregister, based on their machineActor (#5070)

* Make "Find and select command" global to commandBarMachine

* Make commands not removed based on their actor state, only disabled

* Sort commands better in CommandComboBox

* Break out sort logic, add a few unit tests

* Fix missed name change

* Needed to make one more change from source branch:
since `optionsFromContext` now only gets fired once, I/O-based options need to use the `options` config instead.

---------

Co-authored-by: 49fl <ircsurfer33@gmail.com>
This commit is contained in:
Frank Noirot
2025-01-16 12:08:48 -05:00
committed by GitHub
parent 0a1a6e50cf
commit 3f855d7bad
9 changed files with 149 additions and 36 deletions

View File

@ -63,12 +63,11 @@ export const projectsCommandBarConfig: StateMachineCommandSetConfig<
name: {
inputType: 'options',
required: true,
options: [],
optionsFromContext: (context) =>
context.projects.map((p) => ({
options: (_, context) =>
context?.projects.map((p) => ({
name: p.name!,
value: p.name!,
})),
})) || [],
},
},
},
@ -80,12 +79,11 @@ export const projectsCommandBarConfig: StateMachineCommandSetConfig<
oldName: {
inputType: 'options',
required: true,
options: [],
optionsFromContext: (context) =>
context.projects.map((p) => ({
options: (_, context) =>
context?.projects.map((p) => ({
name: p.name!,
value: p.name!,
})),
})) || [],
},
newName: {
inputType: 'string',