Fix infinite spinner when 400 error occurs due to 50k node limit by s…#11901
Fix infinite spinner when 400 error occurs due to 50k node limit by s…#11901Shyam-123pandey wants to merge 3 commits intoopenstreetmap:developfrom
Conversation
…afely subdividing tiles
There was a problem hiding this comment.
Pull request overview
This pull request attempts to fix an infinite spinner issue that occurs when the OpenStreetMap API returns a 400 Bad Request error due to exceeding the 50,000 node limit for a bounding box query. The fix introduces tile subdivision to break large tiles into smaller quadrants when a 400 error is encountered, and adds state management with a new _isLoading flag to track loading status.
Changes:
- Added 400 error handling with automatic tile subdivision up to 3 levels deep
- Introduced
_isLoadingflag to track loading state independently of inflight requests - Modified retry logic to handle 400 errors differently from rate limit errors
|
|
||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
There are no test cases for the new 400 error handling and tile subdivision logic. Given that this fix addresses a critical bug (infinite spinner), test coverage is important to prevent regression.
Consider adding tests that verify:
- A 400 error triggers tile subdivision into 4 child tiles
- Child tiles are loaded with incremented depth
- Subdivision stops at MAX_SUBDIVISION_DEPTH
- The spinner stops after subdivision completes
- No retry occurs for 400 errors after subdivision
| // At or beyond MAX_SUBDIVISION_DEPTH, do not retry 400 errors. | |
| return; |
There was a problem hiding this comment.
right that additional test coverage would be beneficial, especially around subdivision and spinner behavior.
However, since this PR is focused on resolving the immediate infinite spinner issue with minimal scope change, I kept the changes isolated to the service logic.
I’d be happy to follow up with a separate PR that adds targeted tests for 400 handling and subdivision depth limits to avoid mixing behavioral fixes with broader test additions.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
I am changing variable name at this time Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Hello Sir, good morning. |
Fix infinite spinner when OSM API returns 400 for large bbox #11459
What this fixes
When the OSM API returns a
400 Bad Requestfor/map.json?bbox=...(typically caused by the 50k node limit), the editor keeps retrying the same tile and the loading spinner never stops.Even after API requests stop in the network tab, the tile remains in
_tileCache.inflight, so the spinner continues indefinitely.What was changed
400responses_tileCache.inflightand_tileCache.toLoadResult
Please take a look of vedio: https://drive.google.com/file/d/1-3UsnZWG6jUg05__sEQULTYYidnYVkZg/view?usp=drive_link
Tested by forcing a bbox that exceeds the 50k node limit.
I have added a vedio in comment of this issue if want please you can check for fixes.
Thanks