Просмотр исходного кода

Merge pull request #6008 from overleaf/ae-clear-cache-file-list

[web] Clear the list of downloadable files after clearing the compile cache

GitOrigin-RevId: d1d655612e6705f77c283b06012f8b5c14ed8f7a
Miguel Serrano 4 лет назад
Родитель
Сommit
5126d756fe
1 измененных файлов с 11 добавлено и 4 удалено
  1. 11 4
      services/web/frontend/js/shared/context/compile-context.js

+ 11 - 4
services/web/frontend/js/shared/context/compile-context.js

@@ -380,10 +380,17 @@ export function CompileProvider({ children }) {
   const clearCache = useCallback(() => {
     setClearingCache(true)
 
-    return compiler.clearCache().finally(() => {
-      setClearingCache(false)
-    })
-  }, [compiler, setClearingCache])
+    return compiler
+      .clearCache()
+      .then(() => {
+        setFileList(undefined)
+        setPdfDownloadUrl(undefined)
+        setPdfUrl(undefined)
+      })
+      .finally(() => {
+        setClearingCache(false)
+      })
+  }, [compiler, setPdfDownloadUrl, setPdfUrl])
 
   // clear the cache then run a compile, triggered by a menu item
   const recompileFromScratch = useCallback(() => {