Repository navigation
Conversation
Each topic-tree leaf row renders a topic-live-value that subscribes to its topic while it exists; Angular Aria renders a tree group only while its parent is expanded, so collapsed branches hold no subscriptions. The tree build no longer creates a toSignal per leaf. Storage replays each topic's latest value to new subscribers, so a row shown on expand starts from it; the map's live trace skips that replay (as in #994), since after a run change it is the last run's fix. Flat mode still renders, and so subscribes, every leaf. Ported from #987's spike (ead2873). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013vbA3j9hMDhLiYyTkHLpH8 Co-Authored-By: bracyw <138251570+bracyw@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
TheJeffreyKuo
left a comment
There was a problem hiding this comment.
Looks good, a problem and a few nits caught
| // Leaf toSignal()s can't be created in a reactive context; they clean up via the injector. | ||
| return untracked(() => mapNodesToTreeNodes(nodes, this.storage, this.injector)); | ||
| }); | ||
| /** Holds no live values: each leaf row subscribes to its topic only while it is rendered, i.e. while its parents are expanded. */ |
There was a problem hiding this comment.
Render the tree only while the drawer is open; closed, its expanded rows stay subscribed
| }) | ||
| export class TopicLiveValueComponent { | ||
| topic = input.required<string>(); | ||
| precision = input(3); |
There was a problem hiding this comment.
Nit: Drop precision; nothing binds it
|
|
||
| constructor() { | ||
| // A plain subscription per row rather than a toObservable/switchMap chain: flat mode renders ~900 of these. | ||
| effect((onCleanup) => { |
There was a problem hiding this comment.
Nit: Subscribe once in ngOnInit; a row's topic never changes
Changes
Stacked on #1011. Each sidebar leaf row renders a live-value component that subscribes to its topic only while the row is rendered; the tree build no longer subscribes per leaf. An expanded row shows the topic's latest value at once when something else already reads it (#1011's storage replay); otherwise N/A until the next value. Angular Aria already destroys collapsed groups.
Diagram
flowchart LR subgraph Tree["Sidebar rows"] direction TB EX["Tree: node expanded"] --> RR["Its child rows rendered"] FL["Flat mode"] --> AR["Every topic's row rendered"] CO["Tree: node collapsed"] --> XR["Its rows destroyed"] end RR --> LV["Each row's live value:<br/>storage.get(topic) while the row exists"] AR --> LV XR --> REL["Row unsubscribes;<br/>topic leaves the list<br/>at the next sweep (every 2.5 s)"] LV --> ST["Storage replays the latest value,<br/>so a row shows one at once<br/>if the page already reads it"]Testing
Screenshots
Taken locally, not attached.
Notes
Checklist
Closes #996