fix: frontend: error displayed persisted even after a new successful request

Massimo Melina committed Dec 31, 2021 at 18:18 UTC 82c7b86d49d89c26088b59a2cf07c56d2141c882
3 files changed +5 -2
frontend/src/Head.ts
+2 -1
@@ -148,7 +148,8 @@ function FolderStats() {
148 }, [list])
149 const { filteredEntries, stoppedSearch } = useSnapState()
150 return h('div', { id:'folder-stats' },
151 - stoppedSearch ? hIcon('interrupted', { title:'Search was interrupted' }) : loading && h(Spinner),
151 + stoppedSearch ? hIcon('interrupted', { title:'Search was interrupted' })
152 + : list?.length>0 && loading && h(Spinner),
153 [
154 prefix('', stats.files,' file(s)'),
155 prefix('', stats.folders, ' folder(s)'),
frontend/src/useFetchList.ts
+2 -1
@@ -25,7 +25,6 @@ export default function useFetchList() {
25 state.stopSearch?.()
26 return
27 }
28 - setLoading(true)
28
29 ;(async ()=>{
30 const API = 'file_list'
@@ -33,6 +32,8 @@ export default function useFetchList() {
32 const baseParams = { path:desiredPath, search, sse, omit:'c' }
33 let list: DirList = []
34 setList(list)
35 + setLoading(true)
36 + setError(undefined)
37
38 if (sse) { // buffering entries is necessary against burst of events that will hang the browser
39 const buffer:DirList = []
todo.md
+1
@@ -1,4 +1,5 @@
1 # To do
2 +- platform-independent crc32 module
3 - anti-csrf
4 - file sorting
5 - folders before?