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

Search submit button can get stuck in loading state, when changing e.g. search query fast, while the search is submitting. #16883

Closed
linuspahl opened this issue Oct 10, 2023 · 1 comment · Fixed by #18450
Labels

Comments

@linuspahl
Copy link
Contributor

Expected Behavior

The search button should not display the loading indicator, when the search is not loading.

Current Behavior

When you execute the search and change e.g. the search query very fast, it is possible that isSubmitting in the formik state stays true in some cases.

In the following examples, I pressed enter after removing "test":

submit.problem.mov

It looks like in this case the code after validateFormWithHighPriority().then https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Formik.tsx#L741 is not being executed and isSumitting is not set to true anymore, probably because it is being interrupted by the new validation. I am not sure yet why exactly it behaves like this.

Your Environment

  • Graylog Version: 5.2 beta1, but it probably also occurs in previous versions
@linuspahl linuspahl added the bug label Oct 10, 2023
@dennisoelkers
Copy link
Member

This is related to the debouncing of the query string validation method. With debouncing, when multiple calls are happening in a time span, only one of them wins. The way it is implemented for query string validation, is that a promise is returned which will either resolve or stay pending forever.

The problem happens when a validation triggered by a change is running "at the same time" as a validation triggered by a submit. If in this situation the debounced call triggered by the validation "wins", its promise will resolve and the promise of the validation triggered by the submit will stay pending forever, also leading to the formik submit attempt never ending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants