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): significantly more predictable form state events #11597

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

Conversation

jacobsfletch
Copy link
Member

@jacobsfletch jacobsfletch commented Mar 7, 2025

Currently, form state events are triggered by a debounced useEffect. This, however, is very unpredictable and can lead to many bugs, including infinite loops (verified). Rather than relying on the rendering lifecycle and deep comparisons, we need to dispatch form state events declaratively.

This change completely removes the reliance on a useEffect in the Form component and instead calls form state on demand through a useCallback function. This change requires the removal useReducer for state management, and instead calls a reducer-like function directly.

More details to come.

@jacobsfletch jacobsfletch marked this pull request as draft March 7, 2025 22:56
@jacobsfletch jacobsfletch changed the title fix fix(ui): significantly more predictable form state events Mar 7, 2025
@payloadcms payloadcms deleted a comment from github-actions bot Mar 7, 2025
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.

1 participant