fix(categories): auto-select sole hostname in category builder - #950
Conversation
…ng watchers Category builder initialized queryOptions without a hostname and never called fetchWords on mount, so users with data saw "install a watcher" until they opened Show options and picked a host. Auto-select the only non-unknown hostname after buckets load, and point the empty state at the hostname picker when hosts exist but none is selected. Related to ActivityWatch/activitywatch#1389.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #950 +/- ##
==========================================
+ Coverage 49.36% 49.55% +0.18%
==========================================
Files 45 45
Lines 2769 2779 +10
Branches 625 629 +4
==========================================
+ Hits 1367 1377 +10
Misses 1322 1322
Partials 80 80 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Greptile SummaryThe PR makes the category builder automatically query activity when exactly one known hostname is available and provides more accurate empty-state guidance otherwise.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or non-blocking defects identified in the changed behavior. The sole-host selection receives a deduplicated host list, reactive hostname assignment reaches the existing query watcher, and multi-host or unavailable-host states remain explicitly user-selectable. Important Files Changed
Reviews (1): Last reviewed commit: "fix(categories): auto-select sole hostna..." | Re-trigger Greptile |
|
CI-green and mergeable — 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. |
|
Automated merge handoff for
This head is ready for maintainer review and manual merge. Project monitoring marked it |
Problem
The category builder looks broken until you open Show options and pick a hostname (ActivityWatch/activitywatch#1389). Two things stacked:
queryOptionswas initialized withouthostname, andfetchWords()was not called on mount (commented as "Called by watch" withoutimmediate: true).Change
ensureLoaded(), auto-select the hostname when there is exactly one non-unknownhost.unknown), leave hostname unset and tell the user to open Show options.bucketsStore.hostsis empty.QueryOptionswithv-ifinstead ofv-showso it does not auto-pickhostnameChoices[0]while the panel is still collapsed.Workaround (until this lands)
Open Show options and choose the device hostname.
Test plan
npx jest --selectProjects node --testPathPattern hostnames.test.node