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

Wizard: Debounce unique validation (HMS-4581) #2374

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

ezr-ondrej
Copy link
Collaborator

Debounce the validation, so we don't validate every character. Debounce also ensures the right ordering.
Only one request runs at a time, we cancel the previous before we fire a new.

@ezr-ondrej ezr-ondrej force-pushed the debounce_unique_validation branch 4 times, most recently from b200429 to 392fd32 Compare August 20, 2024 21:35
@ezr-ondrej
Copy link
Collaborator Author

/retest

1 similar comment
@ezr-ondrej
Copy link
Collaborator Author

/retest

@ezr-ondrej ezr-ondrej changed the title Wizard: Debounce unique validation Wizard: Debounce unique validation (HMS-4581) Aug 21, 2024
@ezr-ondrej
Copy link
Collaborator Author

/retest

5 similar comments
@ezr-ondrej
Copy link
Collaborator Author

/retest

@ezr-ondrej
Copy link
Collaborator Author

/retest

@ezr-ondrej
Copy link
Collaborator Author

/retest

@ezr-ondrej
Copy link
Collaborator Author

/retest

@ezr-ondrej
Copy link
Collaborator Author

/retest

@regexowl
Copy link
Collaborator

regexowl commented Aug 26, 2024

The debounce works great, found one edge case - if the user is fast enough they can input already existing name and skip to Review before the validation error shows:

name-validation

They get the error on the next step and need to fix it before creating a blueprint so all's safe. But would it be possible to disable the Next button until validation finishes somehow maybe?

@regexowl regexowl added the ❔ question Further information is requested label Aug 26, 2024
@ezr-ondrej
Copy link
Collaborator Author

ezr-ondrej commented Aug 29, 2024

They get the error on the next step and need to fix it before creating a blueprint so all's safe. But would it be possible to disable the Next button until validation finishes somehow maybe?

Sure :) here we go ;)
It just blocks the user for a bit if the request is slow, but I guess it should be fine in 90% of cases and bit of lag in 10% :)

@ezr-ondrej ezr-ondrej added ✅ ready for review and removed ❔ question Further information is requested labels Aug 29, 2024
Debounce the validation, so we don't validate every character.
Debounce also ensures the right ordering.
Only one request runs at a time, we cancel the previous before we fire a new.
@regexowl
Copy link
Collaborator

Sure :) here we go ;)
It just blocks the user for a bit if the request is slow, but I guess it should be fine in 90% of cases and bit of lag in 10% :)

Beautiful, thank you!

This has similar problem with pristinity as #2305, see #2305 (comment). But I think we should take a look at it separately. Even though we have control over pristinity in this case I think we should keep the way we communicate validation issue consistent throughout wizard.

Copy link
Collaborator

@regexowl regexowl left a comment

Choose a reason for hiding this comment

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

This works really well, thank you!

@regexowl regexowl merged commit e38ffe4 into osbuild:main Aug 29, 2024
5 checks passed
@ezr-ondrej ezr-ondrej deleted the debounce_unique_validation branch August 29, 2024 13:07
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.

3 participants