GetJobber / atlantis

๐Ÿ”ฑ Atlantis
https://atlantis.getjobber.com
MIT License
25 stars 30 forks source link

refactor(components): Improve debounce usage in Autocomplete #1964

Closed jdeichert closed 2 months ago

jdeichert commented 2 months ago

Motivations

While investigating a report of Autocomplete behaving poorly within test suites, I sunk some time into understanding how it works today and found some problems with the debounce strategy.

See comments in PR for more context.

Changes

Added

Changed

Before

https://github.com/user-attachments/assets/b342fa4b-cba9-41b7-93dd-5e64e39dade1

After

Exhibits the exact same behaviour as before, just with improved correctness.

https://github.com/user-attachments/assets/a2109794-4c01-4c41-bd67-362801e64e28

Testing

To test this:

const delayedSearch = debounce(updateSearch, debounceRate, { leading: true });

Changes can be tested via Pre-release

cloudflare-workers-and-pages[bot] commented 2 months ago

Deploying atlantis with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5df1f3e
Status: โœ…  Deploy successful!
Preview URL: https://16624de9.atlantis.pages.dev
Branch Preview URL: https://cleanup-autocomplete-improve.atlantis.pages.dev

View logs

github-actions[bot] commented 2 months ago

Published Pre-release for 5df1f3e757e932eda207333dbfc15fe564571774 with versions:

  - @jobber/components@5.20.8-CLEANUPau.4+5df1f3e7

To install the new version(s) for Web run:

npm install @jobber/components@5.20.8-CLEANUPau.4+5df1f3e7
jdeichert commented 2 months ago

@taylorvnoj thanks for testing the pre-release! Glad to hear that it's working well over there ๐Ÿ‘Œ