fix(app): swallow file search errors
This commit is contained in:
parent
00e79210e5
commit
712d2b7d15
1 changed files with 8 additions and 4 deletions
|
|
@ -295,6 +295,12 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
|
||||||
const inflight = new Map<string, Promise<void>>()
|
const inflight = new Map<string, Promise<void>>()
|
||||||
const treeInflight = new Map<string, Promise<void>>()
|
const treeInflight = new Map<string, Promise<void>>()
|
||||||
|
|
||||||
|
const search = (query: string, dirs: "true" | "false") =>
|
||||||
|
sdk.client.find.files({ query, dirs }).then(
|
||||||
|
(x) => (x.data ?? []).map(normalize),
|
||||||
|
() => [],
|
||||||
|
)
|
||||||
|
|
||||||
const [store, setStore] = createStore<{
|
const [store, setStore] = createStore<{
|
||||||
file: Record<string, FileState>
|
file: Record<string, FileState>
|
||||||
}>({
|
}>({
|
||||||
|
|
@ -645,10 +651,8 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
|
||||||
setScrollLeft,
|
setScrollLeft,
|
||||||
selectedLines,
|
selectedLines,
|
||||||
setSelectedLines,
|
setSelectedLines,
|
||||||
searchFiles: (query: string) =>
|
searchFiles: (query: string) => search(query, "false"),
|
||||||
sdk.client.find.files({ query, dirs: "false" }).then((x) => (x.data ?? []).map(normalize)),
|
searchFilesAndDirectories: (query: string) => search(query, "true"),
|
||||||
searchFilesAndDirectories: (query: string) =>
|
|
||||||
sdk.client.find.files({ query, dirs: "true" }).then((x) => (x.data ?? []).map(normalize)),
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue