Skip to content
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

Adding draft documents with createIfNotExists overwrites published version #414

Open
DarkSymm opened this issue Nov 23, 2023 · 0 comments
Open
Labels

Comments

@DarkSymm
Copy link

I am adding documents from an external source using the createIfNotExists method. The documents are added as drafts and then are manually adjusted before publishing.

I noticed that everything is reverted to draft after re-importing. It appears that once published if the document is re-submitted as a draft to the createIfNotExists method, the published document gets overwritten with the draft content and reverted back to a draft.

To Reproduce

Import a document as a draft (by appending 'drafts.' to the id) using the createIfNotExists method when there is a published document with the same ID. It will overwrite the published content and set the document as a draft.

Expected behavior

When submitting a draft with the createIfNotExists — if there is already a corresponding published version — it will not overwrite exiting document.

Which versions of Sanity are you using?

@sanity/cli (global) 3.20.0 (latest: 3.20.1)
@sanity/cross-dataset-duplicator 1.2.3 (up to date)
@sanity/eslint-config-studio 3.0.1 (up to date)
@sanity/vision 3.20.1 (up to date)
sanity 3.20.1 (up to date)

What operating system are you using?

Mac OS 14.1.1

Which versions of Node.js / npm are you running?

npm 10.2.4
node v20.6.1

@stipsan stipsan added the triaged label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants