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-render result rows when tag-action rules arrive

The tag-action affordance (the per-row checkbox that toggles
#todo <-> #done, plus icon badges) was missing from search result
rows because the rules cache populates asynchronously over the
tag-actions:get-all pubsub roundtrip. The first render() ran with
rules=[], skipping the affordance branch in createSearchResultCard;
nothing then triggered a re-render when the rules eventually
arrived.

Subscribes home.js to tag-actions:get-all:response (already in the
manifest pubsub allowlist) and re-renders when rules update, but
only if there are results to redraw.

Subscription is installed inside init() AFTER createActionRulesCache
so the cache's internal listener fires first and getRules() returns
the up-to-date set by the time our handler reads it.

+10
+10
features/search/home.js
··· 402 402 // Initialize tag action rules cache for card affordances 403 403 actionRulesCache = createActionRulesCache(api); 404 404 405 + // Re-render when tag-action rules arrive. The rules cache populates 406 + // asynchronously via the tag-actions:get-all pubsub roundtrip; 407 + // without this re-render hook the first render() runs with rules=[] 408 + // and no checkbox / affordance ever appears on result rows. Subscribe 409 + // AFTER createActionRulesCache so the cache's internal listener fires 410 + // first and getRules() returns the up-to-date set when render reads it. 411 + api.pubsub.subscribe('tag-actions:get-all:response', () => { 412 + if (state.results.length > 0) render(); 413 + }); 414 + 405 415 // Parse query from URL 406 416 const params = new URLSearchParams(window.location.search); 407 417 state.query = params.get('q') || '';