-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: handle publish locale with autosave enabled and close dropdown #8719
base: beta
Are you sure you want to change the base?
Conversation
JessChowdhury
commented
Oct 15, 2024
- Fix publish specific locale option when no published versions exist
- Close the publish locale dropdown on click
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.
I'm not sure I understand and it'd be helpful to have an int test so we can support the change made.
@@ -296,7 +296,12 @@ export const updateByIDOperation = async <TSlug extends CollectionSlug>( | |||
} | |||
|
|||
if (publishSpecificLocale) { | |||
publishedDocWithLocales = await getLatestCollectionVersion({ | |||
versionSnapshotResult = await beforeChange({ |
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.
Can you explain the change of order that we have moving the beforeChange up above the getLatestCollectionVersion.
it seems to me that any beforeChange hooks that return values will be overriden by version data and you wouldn't be able to use the latest version data in your beforeChange? Is that expected? I might not be thinking about this correctly.
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.
Yes - I think the confusion here is coming from the double beforeChange
in this file. What you are saying makes complete sense, the beforeChange
that runs on the actual doc happens after on line 316:
let result = await beforeChange({...})
The versionSnapshotResult = await beforeChange
on line 299 is to save a snapshot that is passed to saveVersion
on line 367 and is used no where else in the file.
saveVersion({
...
snapshot: versionSnapshotResult,
})
I only moved the versionSnapshotResult = await beforeChange
up because when I was re-thinking through the steps that happen here, it felt less confusing to me to take the snapshot first and get it out of the way - but no operational reason it needed to be moved.