exo icon indicating copy to clipboard operation
exo copied to clipboard

fix: resolve issue #1025

Open samiamjidkhan opened this issue 2 months ago • 3 comments

Motivation

The TopologyGraph component used D3.js to imperatively rebuild the entire SVG DOM (ported from old dashboard) on every 1-second poll, causing high GPU usage. This violated Svelte's core principle of fine-grained reactivity. https://github.com/exo-explore/exo/issues/1025

Changes

  • Rewrote TopologyGraph.svelte from D3 imperative style to pure declarative Svelte
  • Replaced d3.select().append() DOM manipulation with {#each} blocks and reactive bindings
  • Removed D3 dependency from this component
  • Replaced ResizeObserver with Svelte's bind:clientWidth/clientHeight

Why It Works

Svelte's compiler generates code that diffs individual attribute values. With keyed {#each} blocks ({#each nodes as node (node.id)}), DOM elements persist across updates—only changed attributes (e.g., RAM percentage) are repainted, not the entire graph.

Test Plan

Manual Testing

Hardware: MacBook Pro The topology looks and behaves exactly the same, with lesser GPU usage. Please test on more real nodes @AlexCheema

Automated Testing

N/A

samiamjidkhan avatar Jan 02 '26 05:01 samiamjidkhan