Skip to content

refactor: type store action/mutation payloads#1877

Merged
pedrolamas merged 4 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/store-payload-types
Jun 12, 2026
Merged

refactor: type store action/mutation payloads#1877
pedrolamas merged 4 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/store-payload-types

Conversation

@pedrolamas

Copy link
Copy Markdown
Member

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).

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>
@pedrolamas pedrolamas added this to the 1.37.2 milestone Jun 12, 2026
@pedrolamas pedrolamas requested a review from Copilot June 12, 2026 10:11
@pedrolamas pedrolamas added the Code - Optimizations Everything that relates to code optimizations! label Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread src/store/config/mutations.ts Outdated
Comment thread src/store/files/mutations.ts Outdated
Comment thread src/store/auth/actions.ts Outdated
- 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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 37 changed files in this pull request and generated 1 comment.

Comment thread src/components/settings/auth/AuthSettings.vue Outdated
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 37 changed files in this pull request and generated 1 comment.

Comment thread src/components/settings/auth/AuthSettings.vue Outdated
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 autocomplete attribute. 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.

Comment thread src/store/files/mutations.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 34 out of 37 changed files in this pull request and generated no new comments.

@pedrolamas pedrolamas merged commit 9719797 into fluidd-core:develop Jun 12, 2026
4 checks passed
@pedrolamas pedrolamas deleted the pedrolamas/store-payload-types branch June 12, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code - Optimizations Everything that relates to code optimizations!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants