Skip to content
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

Merged
merged 8 commits into from
Jan 16, 2025

Conversation

franknoirot
Copy link
Collaborator

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.

Copy link

qa-wolf bot commented Jan 15, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Jan 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Jan 16, 2025 2:52pm

@franknoirot franknoirot changed the base branch from franknoirot/4088/create-file-url to main January 15, 2025 17:28
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.99%. Comparing base (c147a21) to head (0cfea48).
Report is 3 commits behind head on main.

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           
Flag Coverage Δ
wasm-lib 85.99% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

since `optionsFromContext` now only gets fired once, I/O-based options need to use the `options` config instead.
Copy link
Contributor

@lf94 lf94 left a 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)

@jtran
Copy link
Collaborator

jtran commented Jan 16, 2025

Where does the flush happen? You said only the connection state does this now.

@franknoirot
Copy link
Collaborator Author

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

Copy link
Collaborator

@jtran jtran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@franknoirot franknoirot merged commit 3f855d7 into main Jan 16, 2025
31 checks passed
@franknoirot franknoirot deleted the franknoirot/4088/disable-cmds branch January 16, 2025 17:08
TomPridham pushed a commit to TomPridham/modeling-app that referenced this pull request Feb 13, 2025
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants