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

fix: input debounce #6478

Merged
merged 2 commits into from
Mar 19, 2024
Merged

fix: input debounce #6478

merged 2 commits into from
Mar 19, 2024

Conversation

canerakdas
Copy link
Member

@canerakdas canerakdas commented Mar 19, 2024

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

After:
image

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npx turbo format to ensure the code follows the style guide.
  • I have run npx turbo test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@canerakdas canerakdas requested a review from a team as a code owner March 19, 2024 16:11
Copy link

vercel bot commented Mar 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Mar 19, 2024 4:13pm

@canerakdas canerakdas added github_actions:pull-request Trigger Pull Request Checks website redesign Issue/PR part of the Node.js Website Redesign labels Mar 19, 2024
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 19, 2024
Copy link
Contributor

github-actions bot commented Mar 19, 2024

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🔴 74 🟢 90 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 91 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 90 🟢 100 🟢 92 🔗
/en/download 🟢 100 🟠 89 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 90 🟢 100 🟢 92 🔗

Copy link
Contributor

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 84%
80.07% (450/562) 79.55% (144/181) 71.17% (79/111)

Unit Test Report

Tests Skipped Failures Errors Time
90 0 💤 0 ❌ 0 🔥 4.86s ⏱️

@ovflowd ovflowd merged commit 2eced3c into nodejs:main Mar 19, 2024
21 checks passed
@micheleriva
Copy link
Contributor

@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.

@ovflowd
Copy link
Member

ovflowd commented Mar 20, 2024

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

micheleriva added a commit to micheleriva/nodejs.org that referenced this pull request Mar 20, 2024
@micheleriva
Copy link
Contributor

@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:

  1. Letting our hot cache die - it gets kept alive when you press each keystroke and speeds up everything
  2. You have to write entire search queries instead of just a few letters - bad UX
  3. Slower interaction time

Please don't apply debounce functions on search.

@marco-ippolito
Copy link
Member

I agree 1 second of debounce is too much

@ovflowd
Copy link
Member

ovflowd commented Mar 20, 2024

What is this debounce being used for? Typing debounce?

@ovflowd
Copy link
Member

ovflowd commented Mar 20, 2024

I don't think the PR should be reverted, but we can reduce the typing debounce to 200ms.

@micheleriva
Copy link
Contributor

Please, no. Orama responds in <200ms, so it's not needed.

github-merge-queue bot pushed a commit that referenced this pull request Mar 20, 2024
* reverts #6478 - removes debounce on search

* fixes style
@canerakdas
Copy link
Member Author

Please don't apply debounce functions on search.

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.

https://github.com/nodejs/nodejs.org/pull/6257/files#diff-f885324b272711e9f25d3ed4b661d3ddddbc0b9dc9a7499d86cbb5a65597397aR74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
website redesign Issue/PR part of the Node.js Website Redesign
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants