fix: optimistic locking for docs editor (prevent edit conflicts)#22
Merged
AngryJay91 merged 2 commits intomainfrom Mar 31, 2026
Merged
fix: optimistic locking for docs editor (prevent edit conflicts)#22AngryJay91 merged 2 commits intomainfrom
AngryJay91 merged 2 commits intomainfrom
Conversation
- Migration 009: ADD COLUMN version INTEGER DEFAULT 1 to docs table - PUT /api/v2/docs/:id: checks client version against DB, returns 409 if mismatch - GET /api/v2/docs/:id: returns version field in response - DocsEditor.vue: sends version on save, shows conflict warning on 409 Closes #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #15
Adds version-based optimistic locking to the docs editor to prevent silent data loss when multiple users edit the same document simultaneously.
Changes
scaffold/pm-api/sql/009-doc-versioning.sql(new)version INTEGER DEFAULT 1column to thedocstablescaffold/pm-api/src/routes/v2-docs.tsGET /:id: now returnsversionfield in doc responsePUT /:id: accepts optionalversionin request bodyversion = 1WHERE version = ?, increments on successcode: 'VERSION_CONFLICT'if version mismatchscaffold/spec-site/src/pages/DocsEditor.vueversionfrom GET response and stores locallyversionwith every PUT save requestBehavior