Address PR review feedback: extract duplicated code, fix Vue reactivity violation, prioritize user config#6
Merged
Conversation
…d mutation, use buttons.json config priority Co-authored-by: w1010tdev <246258262+w1010tdev@users.noreply.github.com>
Co-authored-by: w1010tdev <246258262+w1010tdev@users.noreply.github.com>
Co-authored-by: w1010tdev <246258262+w1010tdev@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add custom virtual joystick functionality for flight simulation
Address PR review feedback: extract duplicated code, fix Vue reactivity violation, prioritize user config
Jan 18, 2026
w1010tdev
approved these changes
Jan 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses prior review feedback by removing duplicated Linux uinput axis-code lists, fixing a Vue reactivity anti-pattern around computed mutation, and ensuring user-saved joystick configuration in buttons.json takes precedence over config.py.
Changes:
- Extracted and lazily initialized a shared
UINPUT_AXIS_CODESmapping for Linux uinput inCustomVirtualJoystick. - Refactored custom-axis mapping initialization in the Vue UI to avoid mutating reactive state inside a computed property.
- Updated virtual joystick initialization to pass user joystick config from
buttons.json, falling back toconfig.pydefaults only if absent.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| static/js/main.js | Refactors custom axis mapping initialization and computed output to avoid computed mutations. |
| server/joystick_manager.py | Deduplicates Linux uinput axis code list; adds user-config override support to VirtualJoystick. |
| server/app.py | Builds/passes joystick config from buttons.json into VirtualJoystick initialization. |
| README.md | Documents configuration precedence and restart requirements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Addresses unresolved review comments from PR #5 regarding code duplication, Vue best practices violations, and configuration priority.
Changes
Extracted duplicated
axis_codeslist (server/joystick_manager.py)UINPUT_AXIS_CODESclass constant with thread-safe lazy initialization_init_gamepad()andset_axis()methodsFixed Vue computed property mutation (
static/js/main.js)initializeCustomAxisMapping()functionwatch()oncustomJoystickAxisCountto handle dynamic axis count changesPrioritized
buttons.jsonoverconfig.py(server/joystick_manager.py,server/app.py)VirtualJoystick.__init__()now accepts optionaljoystick_configparameter from user settingsconfig.pydefaults only when user config unavailablebuttons.jsonDocumented configuration priority (
README.md)buttons.json(Web UI) takes precedence overconfig.pydefaultsExample
Before (computed property mutating reactive state):
After (pure computed with separate initialization):
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.