-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make commands disable, not unregister, based on their machineActor #5070
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5070 +/- ##
=======================================
Coverage 85.99% 85.99%
=======================================
Files 88 88
Lines 31470 31470
=======================================
Hits 27062 27062
Misses 4408 4408
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
since `optionsFromContext` now only gets fired once, I/O-based options need to use the `options` config instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM I'll let you decide if the potential races are worth reconsidering. https://stately.ai/docs/actions#assign-action it is not racing (thanks Frank)
Where does the flush happen? You said only the connection state does this now. |
@jtran it occurs in useStateMachineCommands. This change makes the useEffect within no longer use the machine's state value to refire: https://github.com/KittyCAD/modeling-app/pull/5070/files#diff-4f01815fd6b870902cc62e7facf9e2526532143cdca021ff603cd867e326d03dL88-R87 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…ittyCAD#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 <[email protected]>
Broken out from #4166. Commands have been registered and unregistered based on the actor's state in
useStateMachineCommands
, resulting in a lot of churn in commands. This makes it so that only the connection state flushes the registered commands, not every actor's state.Additionally, it sorts the commands in the command palette options input to surface modeling commands, suppress disabled commands, and otherwise alphabetize.