Skip to content

Commit f9fff65

Browse files
committed
fix(ui): never leave a lineage graph or its controls hidden
Each first-fit attempt is bounded by a frame, so a fit the flow never runs cannot keep the graph hidden, and an empty graph shows its controls.
1 parent f920700 commit f9fff65

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎ui/src/lib/lineage/flow-controller.svelte‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
void flow.fitView({ duration: 300, padding: 0.08, maxZoom: 1, ...opts });
2626
return;
2727
}
28-
// Until the graph has been shown, fit without animating, so it appears already in place. A fit fails
29-
// while cards are still being measured, so it is retried, and the graph shows only after a fit has painted.
28+
// Until the graph has been shown, fit without animating, so it appears already in place. A fit waits
29+
// until the flow can run it, so each try is bounded by a frame; after 20 the graph shows regardless.
3030
void (async () => {
3131
for (let attempt = 0; attempt < 20 && !fitted; attempt++) {
32-
if (await flow.fitView({ padding: 0.08, maxZoom: 1, ...opts, duration: 0 })) {
32+
const fit = flow.fitView({ padding: 0.08, maxZoom: 1, ...opts, duration: 0 });
33+
if (await Promise.race([fit, frame().then(() => false)])) {
3334
await frame();
3435
await frame();
3536
fitted = true;

‎ui/src/lib/lineage/scope-graph.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
});
5858
</script>
5959

60-
<div class="graph sb-flow" class:unfitted={!fitted}>
60+
<div class="graph sb-flow" class:unfitted={!fitted && nodes.length > 0}>
6161
<SvelteFlow
6262
bind:nodes
6363
bind:edges

‎ui/src/lib/lineage/scoped-lineage.svelte‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
</div>
193193

194194
<!-- graph -->
195-
<div class="sb-flow relative min-h-0 flex-1" class:unfitted={!fitted} style="background: var(--sb-inset)">
195+
<div class="sb-flow relative min-h-0 flex-1" class:unfitted={!fitted && nodes.length > 0} style="background: var(--sb-inset)">
196196
<SvelteFlow
197197
bind:nodes
198198
bind:edges

0 commit comments

Comments
 (0)