facebook / Rapid

The OpenStreetMap editor driven by open data, AI, and supercharged features
https://rapideditor.org
ISC License
515 stars 91 forks source link

Aborted API requests can stay in the inflight cache #1451

Open bhousel opened 4 months ago

bhousel commented 4 months ago

This code is in the OSM service, but we might have this issue in other places where we fetch data..

https://github.com/facebook/Rapid/blob/acdc46935275e7b2869f38182a7441db94f2f075/modules/services/OsmService.js#L366-L375

This is unfortunately because we are mixing Promise and callback style code. When the fetch is aborted, it returns and skips calling the errback, (amusingly the comment says // ok). The errback is where the request would be removed from the _tileCache.inflight cache .

Screenshot 2024-05-29 at 10 16 12 AM

What we really should do is:

eneerhut commented 2 weeks ago

@bhousel what implications does this have for the user's experience in Rapid?

bhousel commented 2 weeks ago

what implications does this have for the user's experience in Rapid?

When the bug is triggered, it would show up as a missing square of OSM data that never loads.

eneerhut commented 2 weeks ago

I feel like I might have encountered this. Do you have a rough idea of how often this might occur?

bhousel commented 2 weeks ago

I feel like I might have encountered this. Do you have a rough idea of how often this might occur?

I'm not sure - it would probably depend on how much scrolling and zooming the user is doing.