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

Replace p-debounce by lodash.debounce #1

Merged
merged 2 commits into from
Oct 29, 2021
Merged

Replace p-debounce by lodash.debounce #1

merged 2 commits into from
Oct 29, 2021

Conversation

smart-bo
Copy link
Owner

@smart-bo smart-bo commented Oct 21, 2021

What it does

Fixes eclipse-theia#9139

We used more two libs for debouncing: p-debounce and lodash.debounce,
Since lodash.debounce is used more than p-debounce , we replace p-debounce by lodash.debounce where it used before.

As lodash.debounce return undefine where our API ask for a promise type, we have to write a debounceAsync function to wrap lodash.debounce and return an ideal type.
This function is located at @theia/core/lib/common/promise-util. Other files where is needed import it.

How to test

Some of the functions which use debounce are difficult to test.
it would be better to test the debounceAsync function in a test file,
or in files like theia\packages\debug\src\browser\debug-configuration-manager.ts / theia\packages\core\src\browser\preferences\preference-provider.ts.
The latters run with the start of the application. so we can test that firing the preference is now properly debounced, and will not fire too many times for the same event loop.

Review checklist

Reminder for reviewers

@smart-bo smart-bo changed the title replace lib p-debounce by lib lodash Replace p-debounce by lodash.debounce Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[quality] Use one lib for debounce.
1 participant