Skip to content

Create graph sidebar live values only for rendered rows - #1012

Open
bracyw wants to merge 11 commits into
994-client-topic-subscriptionsfrom
996-sidebar-rendered-row-values
Open

bracyw wants to merge 11 commits into
994-client-topic-subscriptionsfrom
996-sidebar-rendered-row-values

Conversation

@bracyw

@bracyw bracyw commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

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"]
Loading

Testing

  • Specs for the row component (subscribed only while it exists, replay when another reader holds the topic), the tree build, and a sidebar spec pinning Aria destroying collapsed groups
  • In the running app (Chromium): with the tree collapsed, graph-page subscriptions went from 1,855 to 721; expanding a branch added 14 and showed values within a frame, collapsing released them (they leave the server's list at the next sweep, within 2.5 s)

Screenshots

Taken locally, not attached.

Notes

Checklist

  • Commits are tagged with the ticket number
  • Lint, format and tests pass
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots)
  • No package-lock.json changes unless dependencies changed
  • Request reviewers & ping on Slack

Closes #996

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>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1371cae-fd3b-4696-b74d-1225e5558a6c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@bracyw bracyw added frontend Development Focused in the Frontend by: ai Written by AI dev work Implementation work: feature, bug, or task labels Nov 20, 2026 — with Claude
@bracyw
bracyw changed the base branch from 992-one-graph-sidebar to 994-client-topic-subscriptions November 20, 2026 21:10
@bracyw
bracyw added this pull request to stack #1015 November 20, 2026 21:10
@bracyw
bracyw marked this pull request as ready for review November 20, 2026 21:14

@TheJeffreyKuo TheJeffreyKuo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Subscribe once in ngOnInit; a row's topic never changes

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

by: ai Written by AI dev work Implementation work: feature, bug, or task frontend Development Focused in the Frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create graph sidebar live values only for rendered rows

3 participants