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

Build action menus dynamically #454

Merged
merged 1 commit into from
Jan 9, 2025
Merged

Build action menus dynamically #454

merged 1 commit into from
Jan 9, 2025

Conversation

LucasPickering
Copy link
Owner

@LucasPickering LucasPickering commented Jan 9, 2025

Description

Describe the change. If there is an associated issue, please include the issue link (e.g. "Closes #xxx"). For UI changes, please also include screenshots.

This cleans up and deduplicates the code used to generate action menus, and also opens the door for components to provide a dynamic number of actions. It will also make it easier to bind shortcuts to actions.

This also includes a medium-sized refactor of emitters. The Emitter trait has had most of its logic moved to the EmitterHandle struct. Accordingly, the Emitter trait is now called ToEmitter, and EmitterHandle is now just Emitter. This should cut down a bit on static code duplication during compilation, and also simplifies the emitter logic a bit. Components themselves are no longer emitters, instead they just hold emitters. Since components are no longer working directly with Emitter IDs, it's not possible to mix up IDs and emit the wrong type from one. An emitter is just an emitter ID bound to a particular type.

Known Risks

What issues could potentially go wrong with this change? Is it a breaking change? What have you done to mitigate any potential risks?

Big code change = big bug potential. Mitigated with good existing unit tests.

QA

How did you test this?

Leaning on existing tests here

Checklist

  • Have you read CONTRIBUTING.md already?
  • Did you update CHANGELOG.md?
    • Only user-facing changes belong in the changelog. Internal changes such as refactors should only be included if they'll impact users, e.g. via performance improvement.
  • Did you remove all TODOs?
    • If there are unresolved issues, please open a follow-on issue and link to it in a comment so future work can be tracked

This cleans up and deduplicates the code used to generate action menus, and also opens the door for components to provide a dynamic number of actions. It will also make it easier to bind shortcuts to actions.

This also includes a medium-sized refactor of emitters. The Emitter trait has had most of its logic moved to the EmitterHandle struct. Accordingly, the Emitter trait is now called ToEmitter, and EmitterHandle is now just Emitter. This should cut down a bit on static code duplication during compilation, and also simplifies the emitter logic a bit. Components themselves are no longer emitters, instead they just hold emitters. Since components are no longer working directly with Emitter IDs, it's not possible to mix up IDs and emit the wrong type from one. An emitter is just an emitter ID bound to a particular type.
@LucasPickering LucasPickering enabled auto-merge (rebase) January 9, 2025 15:23
@LucasPickering LucasPickering merged commit 5a0da53 into 3.0 Jan 9, 2025
15 checks passed
@LucasPickering LucasPickering deleted the menu-refactor branch January 9, 2025 15:27
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.

1 participant