Explorar o código

fix asset delete cache update

Klaudiusz Dembler %!s(int64=3) %!d(string=hai) anos
pai
achega
4c2dd96142
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      src/api/client/cache.ts

+ 5 - 0
src/api/client/cache.ts

@@ -54,6 +54,11 @@ const createCachedUrlsHandler = () => ({
 
 const createCachedAvailabilityHandler = () => ({
   merge: (existing: AssetAvailability | undefined, incoming: AssetAvailability) => {
+    if (incoming === AssetAvailability.Invalid) {
+      // if the incoming availability is invalid that means we deleted the asset so we shouldn't care about what's in cache
+      return incoming
+    }
+
     if (existing === AssetAvailability.Accepted) {
       // if the asset is already accepted, update most probably means that:
       // fresh fetch is trying to overwrite local optimistically updated data