From c696b504ab5aaef6bcdfb9f7607a9efd2653e3f6 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 22 Feb 2026 12:10:45 +0000 Subject: [PATCH] fix(timeline): use group.id instead of group.content for bucket ID lookup When showRowLabels=false (e.g. in the Raw Data bucket view), group.content is set to '' to hide row labels, causing onSelect to resolve an empty bucket ID and producing broken API calls like: GET /api/0/buckets//events/{event_id} Fix by using group.id (always the bucket ID) instead of group.content for the bucketId lookup. Also guard against editing events with null ID (merged query results) or placeholder bucket IDs ('events', 'search') used in Search/Query views, where no real bucket is available. These cases now return early instead of making a doomed 404 request. Fixes ActivityWatch/aw-webui#576 --- src/visualizations/VisTimeline.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/visualizations/VisTimeline.vue b/src/visualizations/VisTimeline.vue index 97a5ad6c..a9b67af1 100644 --- a/src/visualizations/VisTimeline.vue +++ b/src/visualizations/VisTimeline.vue @@ -183,7 +183,18 @@ export default { } else if (properties.items.length == 1) { const event = this.chartData[properties.items[0]].event; const groupId = this.items[properties.items[0]].group; - const bucketId = _.find(this.groups, g => g.id == groupId).content; + // Use group.id (not group.content) — content is '' when showRowLabels=false + const bucketId = _.find(this.groups, g => g.id == groupId).id; + + // Skip editing if event has no ID (e.g. merged query results) or bucket is a placeholder + if (!event.id || !bucketId || bucketId === 'events' || bucketId === 'search') { + console.log( + 'Event has no ID or bucket is a placeholder, skipping editor', + event, + bucketId + ); + return; + } // We retrieve the full event to ensure if's not cut-off by the query range // See: https://github.com/ActivityWatch/aw-webui/pull/320#issuecomment-1056921587