fix(categories): enable Save after switching category set (closes #955) - #965
Conversation
Greptile SummaryThe PR fixes category-set persistence by marking the category store dirty when the active set actually changes, while leaving clean same-set selections unchanged.
Confidence Score: 5/5The PR appears safe to merge, with the active-set persistence fix aligned with existing category-store save and discard flows. The changed dirty-state assignment makes genuine set switches saveable, while initialization and current same-set caller paths do not expose a concrete regression. Important Files Changed
Reviews (1): Last reviewed commit: "fix(categories): switchToSet marks dirty..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #965 +/- ##
==========================================
+ Coverage 51.47% 51.69% +0.22%
==========================================
Files 48 48
Lines 2889 2890 +1
Branches 669 637 -32
==========================================
+ Hits 1487 1494 +7
+ Misses 1382 1376 -6
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The failed I pushed |
|
CI-green and mergeable (Greptile 5/5) — waiting only on a maintainer click. This PR is ready to merge, but the bot has pull-only access to this repo and can't self-merge — surfacing it here so it isn't lost. The monitoring loop will stop re-flagging it now that this note is posted. |
b8bb1d3 to
6bb8ff0
Compare
|
Rebased onto current The category fix itself rebased cleanly. Verified locally: category-store tests pass (12/12), TypeScript checks clean, and |
|
@TimeToBuildBob Resolve conflict |
…bling Save Before this fix, selecting a different category set in the dropdown left classes_unsaved_changes=false, so the Save button stayed disabled and the active_set_ids change was never persisted to storage. A page refresh would silently revert to the previous set. Root cause: switchToSet() unconditionally set classes_unsaved_changes=false even though the new active_set_ids hadn't been saved yet. Fix: compute whether the set actually changed before syncing state and set classes_unsaved_changes=true only in that case. Re-selecting the already- active set does not mark dirty (no spurious save prompts on init). Fixes: ActivityWatch#955 Git-Session-Id: fbbd
6bb8ff0 to
e95fc56
Compare
|
Conflict resolved — rebased onto master (which added the |
Problem
When switching between category sets in Categorization Settings, the Save button stays disabled and the selection change is never persisted. A page refresh silently reverts to the previous set.
Root cause:
switchToSet()always setclasses_unsaved_changes = falseafter switching, even though the newactive_set_idsvalue hadn't been written to storage yet. The Save button is gated onclasses_unsaved_changes, so it stayed disabled.Fix
In
src/stores/categories.ts,switchToSet()now:classes_unsaved_changes = truewhen the set changed, activating the Save buttonTwo regression tests added to
test/unit/store/categories.test.node.ts:Testing
Closes #955