Skip to content

refactor: enforce printer state immutability#1874

Merged
pedrolamas merged 3 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/printer-state-immutability
Jun 10, 2026
Merged

refactor: enforce printer state immutability#1874
pedrolamas merged 3 commits into
fluidd-core:developfrom
pedrolamas:pedrolamas/printer-state-immutability

Conversation

@pedrolamas

Copy link
Copy Markdown
Member

Refactor printer state to improve immutability, which leads to better reactivity performance.

Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
@pedrolamas pedrolamas added this to the 1.37.2 milestone Jun 9, 2026
@pedrolamas pedrolamas requested a review from Copilot June 9, 2026 22:42
@pedrolamas pedrolamas added the Code - Optimizations Everything that relates to code optimizations! label Jun 9, 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 the printer Vuex module state handling to reduce in-place mutation and improve reactivity characteristics, primarily by removing the stored printer object list and introducing Object.freeze() for some stored payloads.

Changes:

  • Removed printer.objects from Klipper typings and the printer store default state.
  • Simplified onPrinterObjectsList to only build the subscription map (and refined menu object filtering).
  • Began freezing certain stored printer payloads (info, and some “clear/reset” mutations).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/typings/klipper.d.ts Removes objects from the typed Klipper printer state surface.
src/store/printer/state.ts Drops printer.objects from the default printer store state.
src/store/printer/mutations.ts Removes object-list mutation; adds Object.freeze() in several mutations.
src/store/printer/actions.ts Stops committing printer object list; builds subscriptions directly and adjusts menu filtering.

Comment thread src/store/printer/mutations.ts Outdated
Comment thread src/store/printer/mutations.ts Outdated
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 3 out of 4 changed files in this pull request and generated 2 comments.

Comment thread src/store/printer/actions.ts
Comment thread src/store/printer/actions.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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 3 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/store/printer/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 3 out of 4 changed files in this pull request and generated no new comments.

@pedrolamas pedrolamas merged commit d978cac into fluidd-core:develop Jun 10, 2026
4 checks passed
@pedrolamas pedrolamas deleted the pedrolamas/printer-state-immutability branch June 10, 2026 08:22
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