use api response as a mount check

This commit is contained in:
Peter Clement 2025-05-06 11:31:14 +01:00
parent 4821ce1e8c
commit d19f95f2ec
2 changed files with 2 additions and 3 deletions

View File

@ -85,6 +85,7 @@ describe("AISettings", () => {
})
it("should display the 'Enable BB AI' button", async () => {
API.getConfig.mockResolvedValueOnce({ config: {} })
setupDOM()
await waitFor(() => {
const enableButton = instance.getByText("Enable BB AI")

View File

@ -35,7 +35,6 @@
},
})
let mounted = false
let aiConfig: AIConfig
let configModal: { show: () => void; hide: () => void }
let portalModal: { show: () => void; hide: () => void }
@ -154,14 +153,13 @@
aiConfig = (await API.getConfig(ConfigType.AI)) as AIConfig
const licenseKeyResponse = await API.getLicenseKey()
hasLicenseKey = licenseKeyResponse?.licenseKey
mounted = true
} catch {
notifications.error("Error fetching AI settings")
}
})
</script>
{#if mounted}
{#if aiConfig}
<Layout noPadding>
<Layout gap="XS" noPadding>
<div class="header">