experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(search): re-run query on inline tag toggle so flipped items leave results

When an item's tag affordance is clicked from a search result row
(e.g. flip #todo to #done while searching #todo), the row's tag chip
updated but the item stayed visible — the local re-render reused the
same state.results array.

We already had a tag:item-added / tag:item-removed pubsub subscription
that calls debouncedRefresh, but (a) the 150ms debounce left a
visibly-stale row between click and refresh, and (b) when the bounce
didn't reach the search renderer the row stuck around indefinitely.

Fix: the affordance onToggle callback now calls runSearch + render
directly. The renderer already initiated the change, so it doesn't
need a pubsub round-trip to know to re-evaluate.

+7 -5
+7 -5
features/search/home.js
··· 313 313 rules, 314 314 api, 315 315 onToggle: async () => { 316 - // Refresh tags for the toggled item so re-render shows the new state 317 - const tagsResult = await api.datastore.getItemTags(item.id); 318 - if (tagsResult.success) { 319 - state.itemTags.set(item.id, tagsResult.data); 320 - } 316 + // Re-run the full search so an item that no longer matches the 317 + // query (e.g. user flipped #todo to #done while searching #todo) 318 + // disappears immediately. We don't rely on the tag:item-added / 319 + // tag:item-removed pubsub bounce because (a) it's debounced 150ms 320 + // and (b) we don't want a stale row sitting in results between 321 + // the click and the pubsub round-trip. 322 + await runSearch(); 321 323 render(); 322 324 } 323 325 } : null,