Skip to content

Virtualized console logs#1940

Draft
AaronPlave wants to merge 5 commits into
developfrom
feat/virtualized-logs
Draft

Virtualized console logs#1940
AaronPlave wants to merge 5 commits into
developfrom
feat/virtualized-logs

Conversation

@AaronPlave
Copy link
Copy Markdown
Contributor

@AaronPlave AaronPlave commented Jun 2, 2026

Summary

Improves plan and workspace console log rendering performance through virtualization. Uses tanstack virtualization library already present in the repo. Discovered significant performance issues when testing plans with tens of thousands of invalid directives which slowed the plans page down to a crawl since each directive needed an error console DOM element.

Implementation Details

Some extra work was required to make tanstack svelte virtualization work for these dynamic logs since the library does not support our needs sufficiently out of the box (i.e. actually getting the log expand/collapse + mutable list + filtering all working nicely together).

Verification

  • workspace.test.ts e2e testing of workspace error console
  • plan-console.test.ts e2e testing of plan error console

TODO:

  • Test more of workspace console logs
  • Bug/question – Discuss tradeoff of line wrapping w/o virtualization (current behavior) vs enforced truncation of log messages (when unopened) to fit into single line.

@AaronPlave AaronPlave added the performance A code change that improves performance label Jun 2, 2026
@AaronPlave AaronPlave self-assigned this Jun 2, 2026
The All Problems tab (and other ConsoleLogs tabs) previously rendered
every BaseError via {#each}, producing ~5 DOM nodes per entry. On a plan
with 20k+ activity validation errors that put 100k+ nodes in the layout
tree, which made every global style invalidation (e.g. opening any
Stellar dropdown's focus trap) run a full recalc and forced 500ms+
UpdateLayoutTree on each click.

Virtualize the list with @tanstack/svelte-virtual using a stable
`const virtualizer` plus reactive `setOptions`, so the measurement cache
and scroll position survive prop updates (every $allProblems emit would
otherwise destroy them). Wire the virtualizer's onChange callback into
a scrollTick counter that participates as an explicit dep of the
totalSize/virtualItems reactives — the wrapper emits same-reference
writable updates that don't reliably retrigger Svelte template
expressions, and the canonical recreate pattern would lose scroll/
measurement state on every backend update.

Render the scroll container unconditionally (toggled via class:invisible
when there is nothing to show) so bind:this resolves before onMount,
matching the working canonical test setup. Move the empty state to a
sibling overlay so it can coexist with the always-mounted virtualized
list.

Also drop the competing overflow-y-auto on the Console slot wrapper —
it was acting as an outer scroll boundary that swallowed scroll events
the virtualizer needed to see.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@AaronPlave AaronPlave deployed to test-workflow June 6, 2026 00:22 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance A code change that improves performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant