fix(workspace): preserve query params during sidebar and database navigation

Use URLSearchParams to merge new params instead of replacing the full URL.
This commit is contained in:
kumarabhirup 2026-03-05 22:54:24 -08:00
parent 7dd38c185c
commit 5b87256cac
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167
2 changed files with 6 additions and 2 deletions

View File

@ -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()}`;
}
}, []);

View File

@ -170,7 +170,9 @@ export function DuckDBMissing() {
<button
type="button"
onClick={() => {
window.location.href = "/?send=" + encodeURIComponent("install duckdb");
const params = new URLSearchParams(window.location.search);
params.set("send", "install duckdb");
window.location.href = `/?${params.toString()}`;
}}
className="flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-colors cursor-pointer"
style={{