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

[#60649] Change op-autocompleter debounce to 250ms #17646

Draft
wants to merge 4 commits into
base: release/15.2
Choose a base branch
from

Conversation

myabc
Copy link
Contributor

@myabc myabc commented Jan 17, 2025

⚠️ This change affects all subclasses of OpAutocompleterComponent, not just the work package relations autocompleter WorkPackageRelationsAutocompleteComponent

Ticket

https://community.openproject.org/wp/60649

What are you trying to accomplish?

Change op-autocompleter debounce to 250ms

Increases the debounce to a more typical value (200-300ms) for a complex web application. The current value (50ms)* results in a large number of unnecessary API requests - on installatons with large numbers of work packages, this can lead to severe performance degradation.

  • it's worth noting that most users don't even type this fast!

Screenshots

Screen.Recording.2025-01-17.at.13.17.08.mov

What approach did you choose and why?

⚠️ This PR also includes the patch from #17648 - without it, I cannot run the frontend tests locally.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Increases the debounce to a more typical value (200-300ms) for a complex
web application. The current value (50ms) results in a large number of
unnecessary API requests - on installatons with large numbers of work
packages, this can lead to severe performance degradation.

This partially reverts a change made in commit b0fffbc

Signed-off-by: Alexander Brandon Coles <[email protected]>
@myabc myabc force-pushed the fix/60649-missing-op-autocompleter-debounce branch from c13b2f2 to b7cf586 Compare January 17, 2025 16:22
@myabc myabc added the bugfix label Jan 17, 2025
Fixes `Type 'Timer' is not assignable to type 'number' error when
running `npm run test:watch`.

node typings for `setInterval()` specify `Timer` as its return type.
This patch explicitly calls the browser variant, which returns `number`.

See also TypeStrong/atom-typescript#1053
myabc added 2 commits January 17, 2025 16:29
Implements a `debounceTimeMs` input property, allowing us to tweak the time in component subclasses and individual instances if need be.

This also reverts the zero initial debounce (also introduced in commit b0fffbc).
Comment on lines -526 to -529
if (this.initialDebounce) {
this.initialDebounce = false;
return 0;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the logic that disables the debounce on first user interaction - I don't think this behaviour makes sense (do we really want to make API calls for single letter query strings - in fact it would make more sense to me to only make requests when a minimum number of characters have been entered by the user)

Copy link
Member

Choose a reason for hiding this comment

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

I vaguely remember that I added that to stabilize end-to-end tests. It was done in this commit: 9aa36e5

Sadly, I don't remember much of it and I did not add a lot of comments or information in the commit message.

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

Successfully merging this pull request may close these issues.

2 participants