-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
fix: input debounce #6478
fix: input debounce #6478
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Lighthouse Results
|
@canerakdas, @ovflowd, I am opening an urgent PR to revert this. Please do not apply debounce on search - especially a 1s debounce. This will kill the user experience. It's not a problem if you send thousands of queries to Orama, keep sending them. |
I'm not sure this PR should be reverted. We are still debouncing correctly. Search results are still working correctly. I don't see any issue here |
@ovflowd I see the issue since the search results are slowed down by a lot. We received (correct) complaints about the search being slow, even though it's working fine. Adding a 1s debounce means:
Please don't apply debounce functions on search. |
I agree 1 second of debounce is too much |
What is this debounce being used for? Typing debounce? |
I don't think the PR should be reverted, but we can reduce the typing debounce to 200ms. |
Please, no. Orama responds in <200ms, so it's not needed. |
Debounce was not applied in this PR 👀 If you look at the PR, it aims to fix the debounce method that was used but did not work. |
Description
With this PR, the debounce method we use in the search box has been ensured to work as expected. The request should be triggered when the user has not made any input for 1000ms. The debounce method has been removed from
useEffect
's return to fix the previous state(irrelevant results) issue. When the facet is selected, the total is always correct with the reducer, since the API gives the selected one instead of the total number.Validation
You can check it by searching in the preview.
Example screenshots;
Before:
![image](https://private-user-images.githubusercontent.com/14062599/314086249-56f875ce-afe0-434a-aeaa-0683503fac67.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjMxNTAsIm5iZiI6MTczOTAyMjg1MCwicGF0aCI6Ii8xNDA2MjU5OS8zMTQwODYyNDktNTZmODc1Y2UtYWZlMC00MzRhLWFlYWEtMDY4MzUwM2ZhYzY3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDEzNTQxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZiY2M5NzAxNzJjNTU3M2EyMzZmMDExM2FjOWEwYWFlZmRhZjYyODk2NmVhZDMzOTcxNTgyMjIyYTY3ZTliMmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.LAj-Q-z145YK-l2SbL-AlxwNec3PcJLVkcEY1fJDxFc)
After:
![image](https://private-user-images.githubusercontent.com/14062599/314141206-261fa7b1-c506-4c58-ba94-f1056fe1dd83.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjMxNTAsIm5iZiI6MTczOTAyMjg1MCwicGF0aCI6Ii8xNDA2MjU5OS8zMTQxNDEyMDYtMjYxZmE3YjEtYzUwNi00YzU4LWJhOTQtZjEwNTZmZTFkZDgzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDEzNTQxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJhMGQyNWE3OTBmZjQ2ZmRjMDNmYzU1MWVjNThiYTdiYzY1NDg4NjFhM2FiNTcyNGFkZDFkMmExNGJlZTFhY2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Tj06qDO4ZbSDRZLbaBIplmdvIvfurAIHlJMv8yg-bPQ)
Check List
npx turbo format
to ensure the code follows the style guide.npx turbo test
to check if all tests are passing.npx turbo build
to check if the website builds without errors.