viv
viv copied to clipboard
unnecessary spinner display on re-zoom with cached tiles
Describe the bug
Hey everyone. We faced this issue a year ago after adding Spinner that indicates slide tile loading during requests to the api and everything works fine except one moment: when user tries to zoom in and zoom out to the same place Spinner appears for half a second and disappears(there are no requests to the backend during this loading) but it looks pretty bad and we are looking for a way of solving this issue. We guess that VIV uses kind of cache under the hood where it stores loaded tiles and clear as soon as it overflows. Function that check if all layers are loaded(if true we show spinner):
deckRef?.current?.deck.props.layers .flatMap((lay) => lay) .every(({ isLoaded }) => isLoaded);
Is it possible to prevent slide loading if user zoom in and out to the same place?
Is it possible to understand that viv sent request to the backend to get new tile so we were able to show spinner only during requests?
To Reproduce zoom in and out in the same place
Expected behavior No layers loading because they have been already loaded
Screenshots Small video that demonstrates the issue:
https://github.com/hms-dbmi/viv/assets/36738501/9440e371-46a3-43ab-9d37-5cf743e83dde
Environment: @hms-dbmi/viv: 0.13.8 @deck.gl/core: ~8.8.20
- Browser: Google Chrome
- Browser version: Version 122.0.6261.69 arm64
Thanks for the issue. The title was not very clear. I added one. does that capture the essence of this issue?
There is definitely caching for geotiff and deck.gl. Are you using tiff or zarr?
The reason I ask is that I am not sure how we could check whether or not a tile is in the geotiff cache. If deck.gl does not think the tile is loaded, but geotiff has cached it, I think there is likely no way for us to easily check if something is in the geotiff cache.
There is definitely caching for
geotiffanddeck.gl. Are you using tiff or zarr?
We use tiff
The reason I ask is that I am not sure how we could check whether or not a tile is in the geotiff cache. If deck.gl does not think the tile is loaded, but geotiff has cached it, I think there is likely no way for us to easily check if something is in the geotiff cache.
Thanks for reply. Is it possible to expand cache size somehow?
Thanks for the issue. The title was not very clear. I added one. does that capture the essence of this issue?
Maybe "unnecessary layers loading on re-zoom with cached tiles" ?
Hey guys, can it be a solution? https://deck.gl/docs/api-reference/geo-layers/tile-layer. I mean configurable maxCacheSize. The issue persists also in their sandbox example - if to zoom the map in and out it is not saved in cache
@vadzimvashchanka Yes, I think if you expanded the deck.gl cache size, that could help with the issue. You could also maybe debounce the spinner or something similar so that it only starts after 500ms (during which time the deck.gl cache hopefully catches up with geotiff cache).