Skip to content

fix: TextField validateOnChange with defaultValue executed on start #2411

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

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

AmitShwarts
Copy link
Contributor

@AmitShwarts AmitShwarts commented Jan 9, 2023

Description

Fix bug: validatingOnChange executed on start when providing defaultValue

Changelog

Fix: validatingOnChange executed on start when providing defaultValue

@AmitShwarts AmitShwarts requested a review from lidord-wix January 9, 2023 11:29
Copy link
Contributor

@lidord-wix lidord-wix left a comment

Choose a reason for hiding this comment

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

I added 2 small comments :)

package.json Outdated
@@ -33,7 +33,8 @@
"docs:build": "node scripts/buildDocs.js",
"snippets:build": "node scripts/generateSnippets.js",
"demo": "./scripts/demo.sh",
"release": "node ./scripts/release.js"
"release": "node ./scripts/release.js",
"start:web": "npm --prefix webDemo run start"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please move it to be after the start script? just to keep it in a logical order :)

@@ -42,7 +42,7 @@ export default function useFieldState({
if (props.value !== value) {
setValue(props.value);

if (validateOnChange) {
if (validateOnChange && (!Constants.isWeb || value !== props.defaultValue)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

From what I've seen, it also reproduces on mobile
Please verify it and if it's true, add this condition constantly :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep! you are right :)
i just pushed a fix for your comments.

@AmitShwarts AmitShwarts changed the title fix: TextField validateOnChange on web fix: TextField validateOnChange with defaultValue executed on start Jan 10, 2023
@lidord-wix lidord-wix merged commit 68d2425 into master Jan 10, 2023
@AmitShwarts AmitShwarts deleted the amitshw/fix-web-text-field-valdidate-on-change branch January 10, 2023 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants