Skip to content

Commit f186e09

Browse files
Restore graph preset after failed transition
1 parent 31be36e commit f186e09

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

engraphis/dashboard_assets/ledger.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
graphWorkspace: '',
1919
graphData: null,
2020
graphDataMode: 'overview',
21+
graphDataPreset: 'galaxy',
2122
graphDataIncludeCode: false,
2223
graphDataShowUnlinked: false,
2324
graphDataAsOf: null,
@@ -1142,6 +1143,7 @@
11421143
state.workspace = name;
11431144
state.graphWorkspace = '';
11441145
state.graphData = null;
1146+
state.graphDataPreset = 'galaxy';
11451147
state.graphDataIncludeCode = false;
11461148
state.graphDataShowUnlinked = false;
11471149
state.graphDataRepo = '';
@@ -3490,6 +3492,7 @@
34903492
state.graphData = data;
34913493
state.graphWorkspace = targetWorkspace;
34923494
state.graphDataMode = targetMode;
3495+
state.graphDataPreset = byId('graph-preset').value;
34933496
state.graphDataIncludeCode = responseIncludeCode;
34943497
state.graphDataShowUnlinked = targetShowUnlinked;
34953498
state.graphDataAsOf = targetAsOf;
@@ -3531,9 +3534,14 @@
35313534
: fullGraph && (error.status === 413 || error.code === 'GRAPH_CAPACITY')
35323535
? `All nodes exceed the server capacity. Enter an exact repository filter or reduce the workspace graph. (${error.message})`
35333536
: `Graph unavailable: ${error.message}. Choose Reload data to try again.`;
3534-
if (state.graphData && state.graphDataMode !== targetMode) {
3535-
state.graphMode = state.graphDataMode;
3537+
if (state.graphData) {
3538+
if (state.graphDataMode !== targetMode) state.graphMode = state.graphDataMode;
3539+
/* The toolbar preset changes before a replacement request begins. Restore the
3540+
committed preset together with the committed renderer so a failed Every-node
3541+
transition cannot leave aria-pressed and the active engine disagreeing. */
3542+
byId('graph-preset').value = state.graphDataPreset || 'galaxy';
35363543
updateGraphModeControls();
3544+
syncGraphChoices();
35373545
}
35383546
// Restore the committed renderer's freeze/overlay state. The old engine survived
35393547
// because we never mutated state.graphEngine on the failure path.

tests/e2e/ledger.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ test('Ledger enters Every node from a loaded overview without losing its scope',
483483
expect(allAssetRequests).toHaveLength(1);
484484
});
485485

486-
test('Ledger keeps authored Galaxy coordinates in the Every-node renderer', async ({ page }) => {
486+
test('Ledger keeps authored Galaxy coordinates on the orbit renderer in Every-node view', async ({ page }) => {
487487
await mockApi(page, {
488488
graphScene: {
489489
nodes: [
@@ -518,7 +518,9 @@ test('Ledger keeps authored Galaxy coordinates in the Every-node renderer', asyn
518518

519519
await page.locator('[data-graph-preset-choice="every"]').click();
520520
await expect(page.locator('#graph-canvas')).toHaveAttribute('aria-busy', 'false');
521-
await expect(page.locator('.engraphis-all-canvas')).toHaveCount(1);
521+
// Authored Galaxy scenes intentionally stay on the quality/orbit renderer; the dedicated
522+
// Every-node WebGL canvas is reserved for non-Galaxy complete scenes.
523+
await expect(page.locator('.engraphis-all-canvas')).toHaveCount(0);
522524
await expect(page.locator('.graph-spacetime-overlay')).toHaveCount(1);
523525
});
524526

0 commit comments

Comments
 (0)