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

Fixed issue where initCheck : false was not working #22 #23

Merged
merged 2 commits into from
Feb 23, 2021
Merged

Fixed issue where initCheck : false was not working #22 #23

merged 2 commits into from
Feb 23, 2021

Conversation

DhyeyMoliya
Copy link
Contributor

Fixes Issue : #22

Description : Used field.dirty and config.initCheck to control css class add/remove

Copy link
Contributor

@AnthyG AnthyG left a comment

Choose a reason for hiding this comment

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

LGTM except for the part of updating storeValue right after defining it (maybe I don't fully understand that part tho, reactivity and such :D)

src/index.js Outdated
@@ -141,6 +142,8 @@ export function form(fn, config = {}) {
config
);

storeValue.update(value => ({ ...value, initCheck: config.initCheck }));
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I missing something or could this not just be added to `storeValue` right away 🤔 (so move config above const storeValue = ... (L128)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be done @AnthyG , I did not want to move the structure much, that's why I haven't moved it.

} else {
node.classList.remove(valid);
node.classList.add(invalid);
if ((!context.initCheck && field.dirty) || context.initCheck) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@DhyeyMoliya
Copy link
Contributor Author

@AnthyG Should I make your suggested changes and push again?

@AnthyG
Copy link
Contributor

AnthyG commented Feb 23, 2021

Yeah, if there hasn't been any specific reason why you used storeValue.update instead of moving the config infront of storeValue declaration, do it :D

It keeps the code cleaner in the long run ;)

@DhyeyMoliya
Copy link
Contributor Author

@AnthyG and @chainlist I have updated the code fixing the issue(#22) for initCheck : false. I hope this gets merged soon.

Copy link
Contributor

@AnthyG AnthyG left a comment

Choose a reason for hiding this comment

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

👍

@chainlist
Copy link
Owner

@DhyeyMoliya thanks for the changes!

@chainlist chainlist merged commit 0c72f36 into chainlist:master Feb 23, 2021
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