Widget wiring cleanup #86
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors widget spawning by replacing the old WidgetType + per-widget next_*_num counters with a WidgetConstructor that can instantiate widgets and a centralized WidgetIds allocator.
Changes:
- Introduces
WidgetConstructoras the single source of truth for creating widgets (including parameterized widgets likeScope). - Adds
WidgetIdsto replace the manynext_*_numfields previously stored onDAQApp. - Updates sidebar/ViewerTable UI actions and command palette to spawn widgets using
WidgetConstructor.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/widget_ids.rs | Adds central widget instance ID allocator. |
| src/widget_constructor.rs | Defines widget constructors and creation logic for each widget variant. |
| src/ui/viewer_table.rs | Updates Scope spawn action to use WidgetConstructor. |
| src/ui/sidebar.rs | Updates “Add …” buttons to use WidgetConstructor. |
| src/main.rs | Registers new widget_constructor and widget_ids modules. |
| src/app.rs | Removes per-widget counters and delegates widget creation to WidgetConstructor::create. |
| src/action.rs | Replaces WidgetType with WidgetConstructor in AppAction and command palette list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
irvingywang
approved these changes
Jul 3, 2026
Otherwise the fields of the scope constructor impact it's widget number (ie a scope on message X and scope one message Y would get the same counts)
Issue: hash uses Eq, so scopes still get different counters as well as it's memory inefficent/not preformant to hold all those keys
64866ef to
d4b0474
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
next_widget_name_num)