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): awaits form state before rendering conditional fields #9933

Merged
merged 9 commits into from
Dec 13, 2024

Conversation

jacobsfletch
Copy link
Member

@jacobsfletch jacobsfletch commented Dec 12, 2024

When a condition exists on a field and it resolves to false, it currently "blinks" in and out when rendered within an array or block row. This is because when add rows to form state, we iterate over the fields of that row and render their respective components. Then when conditions are checked for that field, we're expecting passesCondition to be explicitly false, ultimately rendering the field for a brief moment before form state returns with evaluated conditions. The fix is to set these fields into local form state with a new isLoading: true prop, then display a loader within the row until form state returns with its proper conditions.

@jacobsfletch jacobsfletch marked this pull request as ready for review December 12, 2024 18:04
@jacobsfletch jacobsfletch changed the title fix(ui): ensures conditional fields do not blink in and out when rendering fix(ui): awaits form state before rendering conditional fields Dec 13, 2024
@jacobsfletch jacobsfletch enabled auto-merge (squash) December 13, 2024 16:12
@jacobsfletch jacobsfletch merged commit 796df37 into main Dec 13, 2024
54 checks passed
@jacobsfletch jacobsfletch deleted the fix/blinking-conditions branch December 13, 2024 16:42
Copy link
Contributor

🚀 This is included in version v3.7.0

jacobsfletch added a commit that referenced this pull request Dec 16, 2024
Extension of #9933. Custom components are returned by form state,
meaning that if we don't wait for form state to return before rendering
row labels, the default row label component will render in briefly
before being swapped by a custom component (if applicable). Using the
new `isLoading` prop on array and block rows, we can conditionally
render them just as we currently do for the row fields themselves.
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