Skip to content

Virtualized console logs#1940

Open
AaronPlave wants to merge 7 commits into
developfrom
feat/virtualized-logs
Open

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

Conversation

@AaronPlave

@AaronPlave AaronPlave commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

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
@AaronPlave AaronPlave force-pushed the feat/virtualized-logs branch from d214821 to 5d5669a Compare June 2, 2026 21:18
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.
@AaronPlave AaronPlave force-pushed the feat/virtualized-logs branch from 3861e56 to 15941cf Compare June 8, 2026 21:15
@AaronPlave AaronPlave marked this pull request as ready for review June 8, 2026 21:22
@AaronPlave AaronPlave requested a review from a team as a code owner June 8, 2026 21:22
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

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