From 86dfdc687e838912193fe83be6fc9df2c9e5028d Mon Sep 17 00:00:00 2001 From: OadeO6 Date: Thu, 24 Sep 2026 18:46:40 +0000 Subject: [PATCH] fix(ui): keep form state when changing theme --- app/src/ui/Admin.tsx | 22 ++++++++++++---------- app/src/ui/routes/index.tsx | 7 +++++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/app/src/ui/Admin.tsx b/app/src/ui/Admin.tsx index c62eedce..187f49f3 100644 --- a/app/src/ui/Admin.tsx +++ b/app/src/ui/Admin.tsx @@ -17,9 +17,9 @@ export type BkndAdminConfig = { */ basepath?: string; /** - * Sub-path for the Admin UI within the base path - * @default `` - */ + * Sub-path for the Admin UI within the base path + * @default `` + */ admin_basepath?: string; /** * Path to return to when clicking the logo @@ -77,6 +77,14 @@ export default function Admin(props: BkndAdminProps) { ); } +function BkndWrapper({ options, children }: { options?: BkndAdminConfig; children: ReactNode }) { + return ( + }> + {children} + + ); +} + function AdminInner(props: BkndAdminProps) { const { theme } = useTheme(); const config = { @@ -84,16 +92,10 @@ function AdminInner(props: BkndAdminProps) { ...useBkndWindowContext(), }; - const BkndWrapper = ({ children }: { children: ReactNode }) => ( - }> - {children} - - ); - return ( - + {props.children} diff --git a/app/src/ui/routes/index.tsx b/app/src/ui/routes/index.tsx index de83a071..fb5f6598 100644 --- a/app/src/ui/routes/index.tsx +++ b/app/src/ui/routes/index.tsx @@ -12,6 +12,7 @@ import { FlashMessage } from "ui/modules/server/FlashMessage"; import { AuthRegister } from "ui/routes/auth/auth.register"; import { BkndModalsProvider } from "ui/modals"; import { useBkndWindowContext } from "bknd/client"; +import type { BkndAdminProps } from "ui/Admin"; import ToolsRoutes from "./tools"; // @ts-ignore @@ -24,10 +25,12 @@ try { export function Routes({ BkndWrapper, + options, basePath = "", children, }: { - BkndWrapper: ComponentType<{ children: ReactNode }>; + BkndWrapper: ComponentType<{ children: ReactNode; options?: BkndAdminProps["config"] }>; + options?: BkndAdminProps["config"]; basePath?: string; children?: ReactNode; }) { @@ -43,7 +46,7 @@ export function Routes({ - +