Skip to content

Editing, save status and conflicts

An editor must distinguish the values on screen from the values accepted by the owning transaction. Toolora has several save models. Quote drafts use coordinated background persistence; other editors use explicit saves or their own review flow. A status indicator reports that model’s result, not a universal persistence guarantee.

A completed save also has a limited meaning. Saving an editable quote does not send it, and saving a project presentation does not publish every internal record. Frontend mutations traces the corresponding requests. The application transaction boundary determines what an accepted result commits together.

State Meaning in the draft coordinator Visible interpretation
idle Hydrated baseline with no required save Reserved status region; opening the editor does not write
queued Local fingerprint differs and a save is pending Osparade ändringar
saving A save is in progress after the indicator delay Sparar…
saved The accepted snapshot matches current local work Alla ändringar sparade
error The latest snapshot failed Retain work and offer the supplied retry path
conflict The server version no longer matches Retain work and offer the editor’s conflict-resolution path

usePersistedDraft defaults to an 800 ms debounce and 400 ms saving-indicator delay. It allows one in-flight save and coalesces newer edits into a later snapshot. A failed unchanged fingerprint is not automatically retried in a loop. The draft key and generation prevent an old completion from updating a different editor instance.

A successful response acknowledges the snapshot sent, which may be older than edits made while it was saving. The coordinator queues the newer work instead of falsely displaying it as saved. Reverting a local edit does not silently dismiss an established revision conflict.

The quote editor sends its expected timestamp with the complete supported draft change. On 409 it retains the local proposal. Its recovery reads the remote state and compares base, local and remote fields, line rows and recipient rows. Changes that do not conflict can be combined; conflicting values require an explicit choice before background persistence resumes.

Work-site and room saves also participate in leaving the editor. A successful separate work-site change moves the quote revision, so the editor reads back that version before later draft saves. A generic save coordinator does not itself validate commercial authority or tax recipients; those rules remain in the domain transaction.

Purchase-cost edits use a numeric revision and source fingerprint. A stale source or allocation receives a recoverable conflict and retains the office draft. A fresh revision cannot be pasted over an old decision without rechecking the current evidence.

The data router supports a shared leave guard for page navigation, including Back/Forward and programmatic navigation. The registry also supports guarded company switches and sign-out. Each editor chooses whether to flush, stay or ask to discard. Quote drafts attempt to flush; invoice and project editors retain their own explicit-save choices. Same-page query-parameter tabs are not page departure.

The guard’s company/entity scope prevents a permission to leave one editor from being reused after scope changes. Browser reload/close uses the module’s beforeunload handling. Browser prompts are not durable storage and cannot guarantee recovery after a crash.

Two synthetic users edit the same quote. The first changes the description and saves. The second has a different local price change against the earlier version. A conflict triggers remote comparison; the UI must not erase either change or claim the stale request succeeded. If saving times out, error diagnosis reads back the record to determine whether the transaction committed before choosing another action.

The coordinator and leave-guard tests specify coalescing, failures, key changes and navigation decisions. Quote merge tests exercise conflict choices. These component contracts complement API/RPC tests; they do not establish provider delivery or complete recovery of every editor.