Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: correct sidebar persistence

Scott Wilson3478ec101eab
diff --git a/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx b/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx
index 4f3bf7a6dc..b92d96ad59 100644
--- a/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx
+++ b/frontend/src/components/v3/generic/Sidebar/Sidebar.tsx
@@ -86,7 +86,15 @@ function SidebarProvider({
// This is the internal state of the sidebar.
// We use openProp and setOpenProp for control from outside the component.
// eslint-disable-next-line @typescript-eslint/naming-convention
- const [_open, _setOpen] = React.useState(defaultOpen);
+ const [_open, _setOpen] = React.useState(() => {
+ const cookie = document.cookie
+ .split("; ")
+ .find((row) => row.startsWith(`${SIDEBAR_COOKIE_NAME}=`));
+ if (cookie) {
+ return cookie.split("=")[1] === "true";
+ }
+ return defaultOpen;
+ });
const open = openProp ?? _open;
const setOpen = React.useCallback(
(value: boolean | ((value: boolean) => boolean)) => {