Open mzur opened 7 years ago
With the new getSequence
API of the filter service the refresh button should be pretty easy to implement. Maybe a similar API can be implemented for the sorting service.
It can be done like this: Only the active filters and sorting are stored, not their sequences which are required to immediately reproduce the last image sequence. Instead - if any filters or sorting is active - all of them fetch their new sequence when the transect index page is shown. While the sequences are loaded, the buttons in the sidebar show the loading spinner and no images are displayed. Only when all sequences are loaded and the new image sequence is determined the images are displayed. This way the users see why they have to wait (the loading spinners on buttons with active state) and always get a correct image sequence based on the newest data.
btw: Sorting sequences shouldn't change so they won't have to be refreshed.
Torben hat the idea to add a timestamp to the stored image IDs and invalidate any IDs that are older than a day (a week?). Or maybe it can use sessionStorage instead of localStorage and be automatically invalidated once the browser is closed. This would me a much simpler solution than the one described above.
Filtering (and sorting) of images in the transect overview is cached in local storage. This way the same transect overview can be quickly reproduced on refresh (without having to query the server for each filter/sorting) and the sequence of images can be shared with the annotation tool.
These filtering and sorting sequences can become outdated, of course. If a user filters by images "having annotations", then annotates an image previously having no annotation, the filtering of the transect overview is no longer correct.
An easy fix might be an expicit "refresh filtering/sorting" button in the respective popover menu which reloads all filtering/sorting sequences and updates the view.
Maybe a more complex automated behavior can be found, too?