From 5b87256cace62b72e55905ae5dcee4b78e561ce9 Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Thu, 5 Mar 2026 22:54:24 -0800 Subject: [PATCH] fix(workspace): preserve query params during sidebar and database navigation Use URLSearchParams to merge new params instead of replacing the full URL. --- apps/web/app/components/sidebar.tsx | 4 +++- apps/web/app/components/workspace/database-viewer.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/app/components/sidebar.tsx b/apps/web/app/components/sidebar.tsx index e44a1e42360..6b4feed7115 100644 --- a/apps/web/app/components/sidebar.tsx +++ b/apps/web/app/components/sidebar.tsx @@ -216,7 +216,9 @@ function WorkspaceSection({ tree, onRefresh }: { tree: TreeNode[]; onRefresh: () const handleSelect = useCallback((node: TreeNode) => { // Navigate to workspace page for actionable items if (node.type === "object" || node.type === "document" || node.type === "file" || node.type === "database" || node.type === "report") { - window.location.href = `/?path=${encodeURIComponent(node.path)}`; + const params = new URLSearchParams(window.location.search); + params.set("path", node.path); + window.location.href = `/?${params.toString()}`; } }, []); diff --git a/apps/web/app/components/workspace/database-viewer.tsx b/apps/web/app/components/workspace/database-viewer.tsx index e86b328f5e9..6c418d0fc16 100644 --- a/apps/web/app/components/workspace/database-viewer.tsx +++ b/apps/web/app/components/workspace/database-viewer.tsx @@ -170,7 +170,9 @@ export function DuckDBMissing() {