-
Notifications
You must be signed in to change notification settings - Fork 326
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
Field validation system 2 #2488
Field validation system 2 #2488
Conversation
I might need help with this part, @calculuschild @jeddai, if you have a chance. Right now it will save "Beelz", since on every stroke we are loading the value to props and there isn't anything "wrong" with it until we hit the 6th character: if(Object.values(this.state.errs ?? {}).filter(Boolean).length === 0 || !this.state.errs[name]){
e.target.setCustomValidity('');
this.props.onChange({
...this.props.metadata,
[name] : e.target.value
}); Does the And @jeddai -- regarding the incorporation of the Tags validation, is that something you want to do on-top of this PR? I can also take a swing at it but will do it as a branch off of this branch. |
fix an oversight in validations
I've given it a look over and it looks like it might involve a pretty heavy refactor of some pieces to get that behavior. I think I'm ok with the current behavior you have so as not to over-complicate this PR. |
I think a good solution here would be to wrap a metadata editor change handler around the parent change handler. So if the metadata isn't valid, it would not apply those changes to the larger document, and it could be on its own 2.5s debounce. When the debounce ends we could have it override the normal debounce to save immediately and not have a total of 5s before the save.
If you want to take a swing at it you're very welcome to, but I'm happy to branch off your changes and get it added as well. It's up to you! |
@jeddai I think that might be a good approach. Let's save it for a separate PR though since I think this PR does what it set out to do and we've accumulated a bunch of PRs now that are "mostly done" but are now stuck because I was asking for too many nitpick addons that they never get finished. |
That sounds reasonable to me! |
I made the changes requested, except the tie-in with tags. Merge if you want for later addition of tags, or it can wait until it's all done. My kid just woke up so I won't come back to this until later. |
Thanks @Gazook89 ! Merging now! 🎉 💯 ⭐ |
This is the new take on input field validation, focused on the Properties Editor at this point. This PR replaces #2374, and I'll try to port over a good portion of the open discussion points to this comment, though I might need to do it another night. And I'll keep this top comment updated with to-do's.
color: red
or similar