T
TanStack2y ago
fascinating-indigo

Tip on improving data fetching of google map markers

Hey, for a customer I am creating a post pickup point map, using the google maps api, geocoding and autocomplete. For the markers I fetch new markers for the items that are in the viewport, and I do this every-time when the center of the map changes. (it is debounced, so not excessive) I have a useQuery hook, that stores the postalcode for each search as a cache key, this is a limitation of the API we are using, it does not accept bounds or latlng values. Since I fetch the data for every postalcode seperatly, the other markers are not longer visible when zooming out, which is the way it should work since those cache keys are no longer active. I was wondering if there is a way to append data to an existing cache using infinite queries or something, but reading the docs, I cant really figure out if that is even possible. Since I don't have information if there are more points to retrieve or not. (Or if it's even a best practice) Maybe I should just leave it as it is now. This is not a question to give me a technical written out solution, I am just brainstorming and thought why not ask it in here. If you have an idea, or tip in which direction I should look, or if this is just the way to keep it. Let me know. thanks in advance
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?