Skip to content

fix(console): keep graph editor in sync with route identity - #45

Merged
alice-viola merged 2 commits into
masterfrom
fix/reload-graph-editor-route
Sep 7, 2026
Merged

fix(console): keep graph editor in sync with route identity#45
alice-viola merged 2 commits into
masterfrom
fix/reload-graph-editor-route

Conversation

@albertovincenzi

Copy link
Copy Markdown
Collaborator

Perché

Vue Router riusa l’istanza di GraphEdit quando cambia soltanto :app o :name. Il componente caricava il documento esclusivamente in onMounted, quindi una navigazione tra due URL di edit poteva lasciare nel textarea il JSON del grafo precedente. Salvare a quel punto inviava quel documento all’identità mostrata nel nuovo URL. Inoltre una risposta lenta del primo grafo poteva arrivare dopo quella del secondo e sovrascriverla.

Fix

  • osserva la coppia (app, name) con esecuzione immediata, invece di affidarsi al solo mount;
  • azzera errori, warning e migration quando cambia identità;
  • usa un token monotono per ignorare successi o errori appartenenti a una route precedente;
  • gestisce con lo stesso percorso anche il template /graphs/new.

Verifica

  • npm run build (Vite, 52 moduli);
  • git diff --check.

Il repository attuale non definisce uno script npm test; la PR #19 ne introduce uno per l’infrastruttura di polling, ma non contiene un harness per componenti Vue.

Nota per Alice

Il comportamento normale del primo caricamento non cambia. Il punto da valutare è la protezione dell’identità: una risposta viene applicata solo se appartiene ancora alla stessa coppia app/grafo richiesta dalla route.

albertovincenzi and others added 2 commits September 5, 2026 00:52
…clarable

`loadDocument` reset `error`, `conflict`, `warnings` and `migration` on an
identity change but never `text`, and `loading` drops to false in the `finally`
whichever way the load ended. So a failed GET left the editor showing B's
title, B's Cancel link, an error card — and A's JSON in an enabled textarea.

That is not a display bug. `as_graph` sets `doc.graph` from the path segment,
so the server does not refuse the mismatch: one Declare click replaces B's
nodes, paths and budgets with A's. Reached by moving back and forward between
two `/edit` URLs while the second load fails, which is the same route record
and therefore the reuse this change exists to handle.

- clear `text` with the rest of the load state
- hold Declare disabled while a load error stands, tracked separately from
  `error` so a refused SAVE still leaves the button available to retry

Claude-Session: https://claude.ai/code/session_012K8u7BEJyd6nDNMCQAgH3z
@alice-viola
alice-viola merged commit 6b021ef into master Sep 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants