mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-05-09 05:35:30 +02:00
[GH-ISSUE #447] [Feature]: Refactor Printer Status #276
Labels
No labels
A1
automated
automated
bug
bug
Closed due to inactivity
contrib
dependencies
dependencies
duplicate
enhancement
feedback
hold
invalid
Notes
P1S
pull-request
security
security
ThumbsUp
user-report
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/bambuddy#276
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aneopsy on GitHub (Feb 19, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/447
Originally assigned to: @maziggy on GitHub.
Problem or Use Case
To improve type safety and reduce the risk of bugs, I propose replacing the string type on PrinterStatus.status with a union type of its known values (e.g. 'RUNNING' , 'IDLE' , 'FAILED', 'PAUSE' 'PRINTING'). This ensures only valid states can be assigned, catching typos and invalid values at compile time rather than at runtime.
Pros:
Proposed Solution
.
Alternatives Considered
No response
Feature Category
Monitoring & Stats
Priority
Nice to have
Mockups or Examples
No response
Contribution
Checklist
@aneopsy commented on GitHub (Feb 19, 2026):
in PrinterPage.tsx
Looking at the code above, the state can be either 'PAUSE' or 'PAUSED', but the switch statement below only handles 'PAUSE', it doesn't catch 'PAUSED', which falls through to the default case and is displayed as "Idle". What is the intended difference between PAUSE and PAUSED, or should they be treated the same?
@maziggy commented on GitHub (Feb 19, 2026):
You're right that PAUSED is dead code — the printer only ever sends PAUSE via MQTT gcode_state.
Cleaned this up in 0.2.1b:
Regarding the full union type refactoring — since there are only 5 well-known states coming from MQTT and they're already consistent now, I'm skipping the type alias for now to keep things simple. Happy to revisit if the codebase grows more state checks.