fix(webui): cache tool catalogs across settings navigation (#6552)
* fix(webui): cache tool catalogs across settings navigation * refactor(webui): remove unreachable catalog invalidation condition
This commit is contained in:
1 parent
62c2ed4e7e
commit
8632940a99
15 files changed
+424
-31
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { SettingsView } from "@/components/settings/SettingsView";
|
||||
import { settings } from "@/dev/gallery/settings";
|
||||
|
||||
export function installToolsCatalogPreviewApi() {
|
||||
const fetch = window.fetch.bind(window);
|
||||
window.fetch = (input, init) => String(input) === "/api/settings"
|
||||
? Promise.resolve(Response.json(settings))
|
||||
: fetch(input, init);
|
||||
}
|
||||
|
||||
export function ToolsCatalogFixture() {
|
||||
const [open, setOpen] = useState(true);
|
||||
return <main>
|
||||
<button onClick={() => setOpen(value => !value)}>{open ? "Leave settings" : "Open settings"}</button>
|
||||
{open && <SettingsView
|
||||
initialSection="apps"
|
||||
initialSettings={settings}
|
||||
themePreference="light"
|
||||
onChangeTheme={() => {}}
|
||||
onModelNameChange={() => {}}
|
||||
onBackToChat={() => setOpen(false)}
|
||||
/>}
|
||||
</main>;
|
||||
}
|
||||
Reference in new issue
Block a user