瀏覽代碼

fix asset delete cache update

Klaudiusz Dembler 3 年之前
父節點
當前提交
4c2dd96142
共有 1 個文件被更改,包括 5 次插入0 次删除
  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