fix: ui fixes
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user