diff --git a/app/(app)/u/[handle]/layout.tsx b/app/(app)/u/[handle]/layout.tsx index 667a0aa9..2c131eba 100644 --- a/app/(app)/u/[handle]/layout.tsx +++ b/app/(app)/u/[handle]/layout.tsx @@ -51,10 +51,16 @@ export default function PublicProfileLayout(props: { useEffect(() => { if (!isOwn) return; // Preserve whatever sub-path the visitor is on so /u//collections - // jumps to /u/me/collections (and so on for /posts, /mentions). + // jumps to /u/me/collections (and so on for /posts, /mentions). Also + // carry over the query string and hash — the hash holds the post anchor + // (#post-) from share links, and it's only readable on the client + // (the server never receives it), which is why we read window.location + // here rather than from pathname / useSearchParams. const m = pathname.match(/^\/u\/[^/]+(\/.*)?$/); const suffix = m?.[1] ?? ""; - router.replace(`/u/me${suffix}`); + const search = window.location.search; + const hash = window.location.hash; + router.replace(`/u/me${suffix}${search}${hash}`); }, [isOwn, router, pathname]); useEffect(() => { diff --git a/components/feed/new-users-strip.tsx b/components/feed/new-users-strip.tsx index 5bd5d4d3..474d6832 100644 --- a/components/feed/new-users-strip.tsx +++ b/components/feed/new-users-strip.tsx @@ -10,7 +10,6 @@ import { useRef } from "react"; import Link from "next/link"; -import { Sparkles } from "lucide-react"; import type { UserSummary } from "@/lib/social"; import { UserAvatar } from "@/components/ui/user-avatar";