diff options
| author | MohamedBassem <me@mbassem.com> | 2025-08-23 17:24:16 +0300 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2025-08-23 17:24:16 +0300 |
| commit | 6dde9f209060cc31b55847d465533afb879bb018 (patch) | |
| tree | eb6a52d9dd1a6ff259c1e1a414a82e277b43c682 /apps/web | |
| parent | 8c205249941bbd503ee452b0dd857f173bf74363 (diff) | |
| download | karakeep-6dde9f209060cc31b55847d465533afb879bb018.tar.zst | |
fix: preserve selected section in link preview in query params
Diffstat (limited to 'apps/web')
| -rw-r--r-- | apps/web/components/dashboard/preview/LinkContentSection.tsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/web/components/dashboard/preview/LinkContentSection.tsx b/apps/web/components/dashboard/preview/LinkContentSection.tsx index a0a6f580..53559aa0 100644 --- a/apps/web/components/dashboard/preview/LinkContentSection.tsx +++ b/apps/web/components/dashboard/preview/LinkContentSection.tsx @@ -1,4 +1,3 @@ -import { useState } from "react"; import Image from "next/image"; import Link from "next/link"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; @@ -26,6 +25,7 @@ import { ExpandIcon, Video, } from "lucide-react"; +import { useQueryState } from "nuqs"; import { ErrorBoundary } from "react-error-boundary"; import { @@ -108,7 +108,9 @@ export default function LinkContentSection({ const availableRenderers = contentRendererRegistry.getRenderers(bookmark); const defaultSection = availableRenderers.length > 0 ? availableRenderers[0].id : "cached"; - const [section, setSection] = useState<string>(defaultSection); + const [section, setSection] = useQueryState("section", { + defaultValue: defaultSection, + }); if (bookmark.content.type != BookmarkTypes.LINK) { throw new Error("Invalid content type"); |
