Update active table editors when external changes arrive #57

Merged
michielbdejong merged 1 commit from codex/live-edit-updates into main 2026-10-19 15:03:01 +02:00

External updates previously left Save/Cancel drafts showing old untouched values, while native controls could replace invalid text that had never been saved. The shared React table now reconciles drafts with live values in both NG-backed editors and /atomic-reuse.

Untouched fields follow incoming values, including removals. Set edits preserve local additions/removals while incorporating external membership changes. Overlapping scalar edits retain the local draft, show the latest value and require “Use latest” or “Keep my value” before Save. A later external change requires a new choice. Native controls retain invalid input and offer “Use latest” when that field changes externally. Save rechecks the values available to the component.

Related to #54; this does not close that issue. The asynchronous gap between checking and persistence still needs a concurrency-safe persistence operation. This change does not add an engine-level conditional commit or change backend replication guarantees.

Validation: all 336 unit tests, six typechecks, 12 production builds and 22 browser tests for both editors and atomic-reuse passed. New browser coverage delivers external patches through a distinct real NG ORM subscription using the test engine fixture; it does not establish broker/CRDT concurrency guarantees. Coverage includes invalid native input, untouched field updates, overlapping drafts, both resolution choices, a second update after resolution, and failed-save retry. Broker-backed synchronization tests were not rerun.

Screenshots

Captured from this PR branch using local demo data. The NG examples receive updates through a separate real ORM subscription backed by the browser test engine.

Untouched fields update while the draft stays intact

Atomic reuse: an external update changes untouched Count from 1 to 2 immediately; the unsaved Title stays intact.

Atomic reuse: an external update changes untouched Count from 1 to 2 immediately; the unsaved Title stays intact.

Overlapping edits require a choice

Atomic reuse: Count is locally 9 and externally 3. The draft is retained, the latest value is shown, and Save is blocked until Use latest or Keep my value is chosen.

Atomic reuse: Count is locally 9 and externally 3. The draft is retained, the latest value is shown, and Save is blocked until Use latest or Keep my value is chosen.

After choosing Keep my value and saving

Atomic reuse: choosing Keep my value and then Save persists Title and Count 9. Use latest instead accepts the incoming value into the draft.

Atomic reuse: choosing Keep my value and then Save persists Title and Count 9. Use latest instead accepts the incoming value into the draft.

Native NG editor: preserve invalid input

Native NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest.

Native NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest.

Atomic NG editor: the same invalid-input handling

Atomic NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest.

Atomic NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest.

External updates previously left Save/Cancel drafts showing old untouched values, while native controls could replace invalid text that had never been saved. The shared React table now reconciles drafts with live values in both NG-backed editors and `/atomic-reuse`. Untouched fields follow incoming values, including removals. Set edits preserve local additions/removals while incorporating external membership changes. Overlapping scalar edits retain the local draft, show the latest value and require “Use latest” or “Keep my value” before Save. A later external change requires a new choice. Native controls retain invalid input and offer “Use latest” when that field changes externally. Save rechecks the values available to the component. Related to #54; this does **not** close that issue. The asynchronous gap between checking and persistence still needs a concurrency-safe persistence operation. This change does not add an engine-level conditional commit or change backend replication guarantees. Validation: all 336 unit tests, six typechecks, 12 production builds and 22 browser tests for both editors and atomic-reuse passed. New browser coverage delivers external patches through a distinct real NG ORM subscription using the test engine fixture; it does not establish broker/CRDT concurrency guarantees. Coverage includes invalid native input, untouched field updates, overlapping drafts, both resolution choices, a second update after resolution, and failed-save retry. Broker-backed synchronization tests were not rerun. ## Screenshots Captured from this PR branch using local demo data. The NG examples receive updates through a separate real ORM subscription backed by the browser test engine. ### Untouched fields update while the draft stays intact Atomic reuse: an external update changes untouched Count from 1 to 2 immediately; the unsaved Title stays intact. ![Atomic reuse: an external update changes untouched Count from 1 to 2 immediately; the unsaved Title stays intact.](https://git.elfaconsortium.eu/attachments/69be6ec7-76b2-44d4-ad5e-30486c29ef2c) ### Overlapping edits require a choice Atomic reuse: Count is locally 9 and externally 3. The draft is retained, the latest value is shown, and Save is blocked until Use latest or Keep my value is chosen. ![Atomic reuse: Count is locally 9 and externally 3. The draft is retained, the latest value is shown, and Save is blocked until Use latest or Keep my value is chosen.](https://git.elfaconsortium.eu/attachments/e2c869f7-2b0e-4922-b222-fd5c1508c488) ### After choosing Keep my value and saving Atomic reuse: choosing Keep my value and then Save persists Title and Count 9. Use latest instead accepts the incoming value into the draft. ![Atomic reuse: choosing Keep my value and then Save persists Title and Count 9. Use latest instead accepts the incoming value into the draft.](https://git.elfaconsortium.eu/attachments/dec2c688-34aa-46aa-92a1-8c758bebfde1) ### Native NG editor: preserve invalid input Native NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest. ![Native NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest.](https://git.elfaconsortium.eu/attachments/68f2cfc2-4a89-47e4-bf87-550e7943f9d8) ### Atomic NG editor: the same invalid-input handling Atomic NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest. ![Atomic NG editor: invalid local Quantity 1.5 remains visible when an external update supplies 8. The notice shows 8 and offers Use latest.](https://git.elfaconsortium.eu/attachments/fd0743fd-3d82-458c-92ef-07c3c402e390)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ELFA/database-apps!57
No description provided.