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

Google Map: Throttle filtering handler to improve performance #478

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

iandunn
Copy link
Member

@iandunn iandunn commented Oct 13, 2023

Fixes #435

This can take 5 or more map re-renders and condense it down to 1, without a noticible effect on responsiveness to the user.

See https://www.developerway.com/posts/debouncing-in-react for the technique I used to make it work across React renders.

I tried debouncing and throttling, but throttling seemed best. With debouncing the handler would often receive the first letter of a search and redraw the map based on that, even though that's not very useful. With throttling it often gets 3-5 characters for the first re-draw, but it still feels faster than waiting on the first debounce.

@iandunn iandunn self-assigned this Oct 13, 2023
This can take 5 or more map re-renders and condense it down to 1, without a noticible effect on responsiveness to the user.

See https://www.developerway.com/posts/debouncing-in-react
@iandunn iandunn force-pushed the map-debounce-search branch from 8a1757b to ea7dc3f Compare October 13, 2023 19:45
@iandunn iandunn marked this pull request as ready for review October 13, 2023 19:56
@iandunn iandunn merged commit 6456a77 into trunk Oct 13, 2023
2 checks passed
@iandunn iandunn deleted the map-debounce-search branch October 13, 2023 19:56
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.

Debounce filteredMarkers
1 participant