|
|
@@ -255,6 +255,9 @@ export async function bootstrapDirectory(input: {
|
|
|
input.setStore("lsp_ready", false)
|
|
|
input.setStore("lsp", [])
|
|
|
if (loading) input.setStore("status", "partial")
|
|
|
+
|
|
|
+ const rev = (providerRev.get(input.directory) ?? 0) + 1
|
|
|
+ providerRev.set(input.directory, rev)
|
|
|
;(async () => {
|
|
|
const slow = [
|
|
|
() => Promise.resolve(input.loadSessions(input.directory)),
|
|
|
@@ -343,6 +346,27 @@ export async function bootstrapDirectory(input: {
|
|
|
input.setStore("mcp_ready", true)
|
|
|
}),
|
|
|
),
|
|
|
+ () =>
|
|
|
+ input.queryClient.ensureQueryData({
|
|
|
+ ...loadProvidersQuery(input.directory),
|
|
|
+ queryFn: () =>
|
|
|
+ retry(() => input.sdk.provider.list())
|
|
|
+ .then((x) => {
|
|
|
+ if (providerRev.get(input.directory) !== rev) return
|
|
|
+ input.setStore("provider", normalizeProviderList(x.data!))
|
|
|
+ input.setStore("provider_ready", true)
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ if (providerRev.get(input.directory) !== rev) console.error("Failed to refresh provider list", err)
|
|
|
+ const project = getFilename(input.directory)
|
|
|
+ showToast({
|
|
|
+ variant: "error",
|
|
|
+ title: input.translate("toast.project.reloadFailed.title", { project }),
|
|
|
+ description: formatServerError(err, input.translate),
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .then(() => null),
|
|
|
+ }),
|
|
|
].filter(Boolean) as (() => Promise<any>)[]
|
|
|
|
|
|
await waitForPaint()
|
|
|
@@ -358,28 +382,5 @@ export async function bootstrapDirectory(input: {
|
|
|
}
|
|
|
|
|
|
if (loading && slowErrs.length === 0) input.setStore("status", "complete")
|
|
|
-
|
|
|
- const rev = (providerRev.get(input.directory) ?? 0) + 1
|
|
|
- providerRev.set(input.directory, rev)
|
|
|
- void input.queryClient.ensureQueryData({
|
|
|
- ...loadProvidersQuery(input.directory),
|
|
|
- queryFn: () =>
|
|
|
- retry(() => input.sdk.provider.list())
|
|
|
- .then((x) => {
|
|
|
- if (providerRev.get(input.directory) !== rev) return
|
|
|
- input.setStore("provider", normalizeProviderList(x.data!))
|
|
|
- input.setStore("provider_ready", true)
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- if (providerRev.get(input.directory) !== rev) console.error("Failed to refresh provider list", err)
|
|
|
- const project = getFilename(input.directory)
|
|
|
- showToast({
|
|
|
- variant: "error",
|
|
|
- title: input.translate("toast.project.reloadFailed.title", { project }),
|
|
|
- description: formatServerError(err, input.translate),
|
|
|
- })
|
|
|
- })
|
|
|
- .then(() => null),
|
|
|
- })
|
|
|
})()
|
|
|
}
|