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

validateBeforeSubmit is not reset on save #11878

Open
siccifolium opened this issue Mar 26, 2025 · 0 comments
Open

validateBeforeSubmit is not reset on save #11878

siccifolium opened this issue Mar 26, 2025 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@siccifolium
Copy link

Describe the Bug

In the DefaultEditView there is a validateBeforeSubmit state which is passed to the Auth component. This seems to be used by the Auth component to inform its parent DefaultEditView when the user has clicked on change password in the users collection. So it basically tells the parent whether or not the inputs for the new password are currently visible and are required to be set when the form is submitted.
The problem is that when I click on change password, and I enter a new password and then save, the ui updates and the password fields are not visible anymore. However the validateBeforeSubmit state still seems to be set to true and therefore when changing for example the email address and then clicking the save button again it complains that I need to fill the required password fields.

Image

I assume the fix for this is kinda simple and that is to just reset the validateBeforeSubmit state to false in the save function.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/tree/main/templates/blank

Reproduction Steps

1.) Take any Payload v3 project with a user collection.
2.) Pick a user to edit
3.) Change password and click save, DO NOT RELOAD THE PAGE
4.) Change the mail address and click save again -> Password fields are still required
5.) Reload the page and change only the mail address and click save -> now it's working

Which area(s) are affected? (Select all that apply)

area: ui

Environment Info

Payload: 3.28.0
@siccifolium siccifolium added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. labels Mar 26, 2025
@github-actions github-actions bot removed the validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. label Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant