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

Nearby: Flawed initial loading of pins. #6044

Closed
savsch opened this issue Dec 17, 2024 · 2 comments · Fixed by #6070
Closed

Nearby: Flawed initial loading of pins. #6044

savsch opened this issue Dec 17, 2024 · 2 comments · Fixed by #6070
Assignees

Comments

@savsch
Copy link
Contributor

savsch commented Dec 17, 2024

Currently, in nearby, when a user scrolls (which also includes resizing) to a new position in the map), a query is made for items in the rectangular geographical area. Although the query is lightweight (made for only P625), it goes on endlessly until timeout for large enough areas.

When a user zooms out enough, the initial query is made for a large area, so the query takes a long time only to end up in a timeout. When the user then zooms in, a second query should be initiated (discarding the first), but it never happens as per the current logic, which ideally shouldn't happen.
This part is easy to fix (by ignoring currently running query after a shorter timeout).

But ideally, the expensive query should never be made in the first place. Reason:
Say, the area is small enough for the query to return (but still large enough for it to return much greater than 1000 items).
Then the resulting items are sorted in-app (by their distance from the map centre), and only the nearest 1000 items are actually utilized.

A workaround would be to first query for the items count. If it's much greater than 1000, then query on a smaller square bound centered on the user (in the same manner as a binary search). Do it till the number of items in the queried area is under $1000 \times \frac{4}{\pi}$.

Here's an example:

Also, if the area is absurdly big, then even the count-binary-search queries (proposed above) can be dropped and a simple overlay saying "zoom in to display pins" can be shown (maybe similar to how chromium based browsers show "No Internet Connection").

@nicolas-raoul
Copy link
Member

Great ideas! I totally agree with all of this.
Do you want to be assigned? (please mention it when creating issues)

@savsch
Copy link
Contributor Author

savsch commented Dec 18, 2024

Do you want to be assigned? (please mention it when creating issues)

Yes, I'll be glad to implement this. I'll make sure to mention if I’d like to be assigned in future issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants