refactor: type store action/mutation payloads#1877
Merged
pedrolamas merged 4 commits intoJun 12, 2026
Conversation
Annotates every action/mutation handler payload that previously fell back to Vuex's implicit `any`, so $typedDispatch/$typedCommit no longer leak `any` through inferred RootActionsType/RootMutationsType. Also tightens a few latent mismatches surfaced along the way (e.g. TemperaturePreset.id, console/charts/macros init payloads, file upload/download progress updates, and timelapse/update-manager notification shapes). Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors Vuex store typings to eliminate implicit any in action/mutation payloads, improving $typedDispatch/$typedCommit type-safety across the app’s Moonraker-driven data flow.
Changes:
- Added/expanded Moonraker typings for update-manager and timelapse event payloads.
- Annotated many Vuex actions/mutations with explicit payload types (including several notification handlers).
- Tightened a few shared model types surfaced by stricter inference (e.g.
TemperaturePreset.id) and aligned various init/progress payload shapes.
Reviewed changes
Copilot reviewed 29 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/typings/moonraker.update_manager.d.ts | Adds UpdateResponse typing used by update notifications. |
| src/typings/moonraker.timelapse.d.ts | Adds NewFrameResponse and Event union for timelapse notifications. |
| src/typings/moonraker.klippy_apis.d.ts | Adjusts subscribe response typing to reflect partial status payloads. |
| src/store/webcams/actions.ts | Types initWebcams payload. |
| src/store/wait/mutations.ts | Types wait mutation payloads as string. |
| src/store/wait/actions.ts | Types wait action args as string. |
| src/store/version/mutations.ts | Types update response mutation payload. |
| src/store/version/actions.ts | Types update notification payloads and update response handler payload. |
| src/store/timelapse/actions.ts | Types timelapse onEvent payload as Moonraker event union. |
| src/store/spoolman/mutations.ts | Types setConnected payload as boolean. |
| src/store/spoolman/actions.ts | Types active spool notification payload. |
| src/store/socket/actions.ts | Types many socket notification payloads routed into modules. |
| src/store/printer/types.ts | Introduces SocketNotifyPayload helper type for fast notify commits. |
| src/store/printer/actions.ts | Types print start/end and fast notify payloads. |
| src/store/mesh/mutations.ts | Types mesh mutation payloads (MatrixType, number, boolean). |
| src/store/mesh/actions.ts | Types mesh action payloads to match mutations. |
| src/store/macros/mutations.ts | Types macros init payload as Partial<MacrosState>. |
| src/store/macros/actions.ts | Types macros init and bulk visibility update payloads. |
| src/store/index.ts | Types void action payload as unknown. |
| src/store/history/actions.ts | Types history update and thumbnail-clear payloads. |
| src/store/files/mutations.ts | Types upload/download progress payloads and root reset payload. |
| src/store/files/actions.ts | Types file-change notifications and upload/download progress actions. |
| src/store/console/mutations.ts | Types console init and several console-setting mutations. |
| src/store/console/actions.ts | Types console init, command history, gcode script result, and auto-scroll payloads. |
| src/store/config/types.ts | Expands TemperaturePreset.id to `number |
| src/store/config/mutations.ts | Types several config mutations (instances/presets) and tweaks persistence placement. |
| src/store/config/actions.ts | Types preset add/update/remove action payloads. |
| src/store/charts/mutations.ts | Types chart init payload as partial state and selected legends payload. |
| src/store/charts/actions.ts | Types chart init and selected legends save payload. |
| src/store/auth/mutations.ts | Types auth mutation payloads (AppUser, arrays, api key). |
| src/store/auth/actions.ts | Types auth user-management payloads. |
| src/store/announcements/actions.ts | Types announcement dismiss/wake payloads and dismiss request payload. |
- addUser now requires a password via AppUserWithPassword, dropping the '?? ""' fallback; password is off the base AppUser type - FileUpload.abortController is optional (set only once an upload starts), matching the real shape pushed by uploadFiles() - setRemovePreset guards splice with an i >= 0 check (was deleting the last preset on a missing key) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Replace the any-typed userDialogState/apiKeyDialogState in AuthSettings
with plain booleans and a dedicated add-only AddUserDialog that emits
{ username, password } directly. Drops the AppUserWithPassword type and
the addUser/removeUser pass-through actions; the component calls
SocketActions directly, matching Login/UserPasswordDialog precedent.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Capture whether the users list is empty before awaiting accessPostUser; notify_user_created may populate it mid-request, skipping checkTrust for the first user. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 37 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/components/settings/auth/AddUserDialog.vue:35
- The password field is missing an
autocompleteattribute. Other auth-related password inputs in the codebase set it (e.g. login and change-password dialogs), and leaving it unset can degrade password manager behavior.
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.
Annotates every action/mutation handler payload that previously fell back to Vuex's implicit
any, so$typedDispatch/$typedCommitno longer leakanythrough inferredRootActionsType/RootMutationsType.Also tightens a few latent mismatches surfaced along the way (e.g.
TemperaturePreset.id, console/charts/macros init payloads, file upload/download progress updates, and timelapse/update-manager notification shapes).