ScoopInstaller / scoopinstaller.github.io

ScoopInstaller homepage and search engine
https://scoop.sh
MIT License
78 stars 18 forks source link

debounce search query state #42

Closed unworthyEnzyme closed 1 year ago

unworthyEnzyme commented 1 year ago

The search bar was pretty janky on my ipad, the input field just froze until the results came. After i inspected the network tab i saw that every keystroke triggers a fetch so i debounced the query. I also wanted to try the new useDeferredValue and useTransition hooks to give a lower priority to setting the results but the project still uses react 17 so i instead use requestIdleCallback (though i am not sure how useful this was).

Note:

This was one of the best tools i used in a while so although not much i wanted to contribute somehow. Thank you for creating such a nice tool and making it available for free.

Note-2:

create-react-app is pretty slow so if you are interested i could try to migrate the project to vite.

gpailler commented 1 year ago

Thanks for the PR @unworthyEnzyme 👍 (and sorry for the delay). I will merge to main to make your change available on https://scoop.sh

About your proposal to switch to vite, it could be quite useful because as you said, CRA is dead slow. It would be great if you can propose a PR and we may switch to it if everything works flawlessly (I never used vite and I my only concern is to have something as straight-forward as CRA so devs can propose changes easily through PRs)

unworthyEnzyme commented 1 year ago

@gpailler sure! To me vite is pretty straightforward to use, i rarely dealt with config file(when building component libraries). It also has a easy to use plugin arthitecture.

gpailler commented 1 year ago

If it's straightforward and almost a drop-in replacement, let's give it a try!