fix: ui fixes

This commit is contained in:
gosangam
2026-06-15 12:17:39 +05:30
parent ab35767374
commit 6cc9285bad
2 changed files with 8 additions and 3 deletions
+8 -2
View File
@@ -51,10 +51,16 @@ export default function PublicProfileLayout(props: {
useEffect(() => {
if (!isOwn) return;
// Preserve whatever sub-path the visitor is on so /u/<own>/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-<id>) 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(() => {