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

fix(ui): disable publish button if form is autosaving #11343

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AlessioGr
Copy link
Member

@AlessioGr AlessioGr commented Feb 22, 2025

Fixes #6648

This PR introduces a new useFormBackgroundProcessing hook and a corresponding setBackgroundProcessing function in the useForm hook.

Unlike useFormProcessing / setProcessing, which mark the entire form as read-only, this new approach only disables the Publish button during autosaving, keeping form fields editable for a better user experience.

I named it backgroundProcessing because it should run behind the scenes without disrupting the user. You could argue that it is a bit more generic than something like isAutosaving, but it signals intent: Background = do not disrupt the user.

@@ -108,6 +110,13 @@ export const Autosave: React.FC<Props> = ({ id, collection, global: globalDoc })
return
}

// Do not autosave if the form is already processing (e.g. if the user clicked the publish button
// right before this autosave runs), as parallel updates could ause conflicts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User can publish during Autosave
2 participants