From a94489dd07f6e372f6aa4c07120463b381bd0688 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 21 Feb 2026 18:42:00 +0100 Subject: [PATCH] fix(grid): preserve active grid query in store to restore context on navigation --- src/components/shared/sidebar.tsx | 17 ++++++++++++++++- src/features/grid/components/grid-client.tsx | 13 ++++++++++++- src/features/grid/store/use-grid-store.ts | 10 ++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/components/shared/sidebar.tsx b/src/components/shared/sidebar.tsx index 30e2f1e..7d630a1 100644 --- a/src/components/shared/sidebar.tsx +++ b/src/components/shared/sidebar.tsx @@ -4,6 +4,8 @@ import { LayoutGrid, Camera, FileDown, Settings, Package, BarChart3 } from "luci import Link from "next/link"; import { usePathname } from "next/navigation"; import { cn } from "@/lib/utils"; +import { useGridStore } from "@/features/grid/store/use-grid-store"; +import { useEffect, useState } from "react"; const NAV_ITEMS = [ { icon: LayoutGrid, label: "Grille", href: "/grid" }, @@ -15,6 +17,12 @@ const NAV_ITEMS = [ export function Sidebar() { const pathname = usePathname(); + const activeGridQuery = useGridStore((s) => s.activeGridQuery); + const [isMounted, setIsMounted] = useState(false); + + useEffect(() => { + setIsMounted(true); + }, []); return (