-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sanity): use optimistic locking when publishing documents #6711
Merged
Conversation
This file contains 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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated May 17, 2024 11:53 AM (UTC)
|
juice49
force-pushed
the
feat/sdx-1315-actions-api-optimistic-locking
branch
from
May 17, 2024 11:01
2c220ac
to
cf97baa
Compare
juice49
force-pushed
the
feat/sdx-1315-actions-api-optimistic-locking
branch
from
May 17, 2024 11:45
091fb25
to
18846d8
Compare
juice49
requested review from
ricokahler and
bjoerge
and removed request for
a team and
ricokahler
May 17, 2024 13:23
bjoerge
approved these changes
May 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
This was referenced Jun 24, 2024
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.
Description
This branch adds optimistic locking when publishing documents via the Actions API by adopting its
ifDraftRevisionId
andifPublishedRevisionId
guards. These guards are a recent addition to the Actions API.Optimistic locking ensures the editor can see the latest state of both the draft document they are publishing, and the published document they are choosing to replace.
Additionally, this branch adds a check prior to publishing that ensures Studio has a draft snapshot. This check is already in place when publishing via the Mutations API. It stands to reason that the editor must be able to see the draft they are choosing to publish.
What to review
Is the usage of the
ifDraftRevisionId
andifPublishedRevisionId
guards correct?Testing
execute
throws if the client has no draft snapshot.packages/sanity/src/core/store/_legacy/document/document-pair/serverOperations/publish.test.ts
.