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

Conditional schema if expression always valid when passing undefined formData #3706

Closed
4 tasks done
cwendtxealth opened this issue May 30, 2023 · 0 comments · Fixed by #3707
Closed
4 tasks done

Conditional schema if expression always valid when passing undefined formData #3706

cwendtxealth opened this issue May 30, 2023 · 0 comments · Fixed by #3707
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned

Comments

@cwendtxealth
Copy link
Contributor

Prerequisites

What theme are you using?

core

Version

5.7

Current Behavior

When evaluating if/then condition, undefined formData is initially passed to evaluate the if condition which will always returns true even if required is set in the if condition. See simple codesandbox which validates a simple "if" conditional expression.

I think in the resolveCondition logic it should always default to empty object if the formData is undefined. This will then make sure the conditional expression is always evaluated correctly.

Expected Behavior

if conditional expression should not be valid for undefined/empty formData object.

Steps To Reproduce

No response

Environment

- OS:
- Node:
- npm:

Anything else?

No response

@cwendtxealth cwendtxealth added bug needs triage Initial label given, to be assigned correct labels and assigned labels May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned
Projects
None yet
1 participant