From 34663552b9e86b5c0a5db049a2adaf763215c162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20My=C5=9Bli=C5=84ski?= Date: Sat, 14 Mar 2026 13:03:44 +0100 Subject: [PATCH] nicolium: respect `with_replies` search param when selecting active tab when `?with_replies=true` was present in the profile url, the profile page still highlighted the "Posts" tab because active tab selection only checked the pathname and ignored the search param --- packages/nicolium/src/features/ui/router/index.tsx | 3 +++ packages/nicolium/src/layouts/profile-layout.tsx | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/nicolium/src/features/ui/router/index.tsx b/packages/nicolium/src/features/ui/router/index.tsx index 669325035..9c75401d1 100644 --- a/packages/nicolium/src/features/ui/router/index.tsx +++ b/packages/nicolium/src/features/ui/router/index.tsx @@ -145,6 +145,9 @@ const layouts = { getParentRoute: () => rootRoute, path: '/@{$username}', component: ProfileLayout, + validateSearch: v.object({ + with_replies: v.optional(v.boolean()), + }), }), remoteInstance: createRoute({ getParentRoute: () => rootRoute, diff --git a/packages/nicolium/src/layouts/profile-layout.tsx b/packages/nicolium/src/layouts/profile-layout.tsx index b25942688..2c6a85530 100644 --- a/packages/nicolium/src/layouts/profile-layout.tsx +++ b/packages/nicolium/src/layouts/profile-layout.tsx @@ -26,6 +26,7 @@ import { LOCAL_STORAGE_REDIRECT_KEY } from '@/utils/redirect'; /** Layout to display a user's profile. */ const ProfileLayout: React.FC = () => { const { username } = layouts.profile.useParams(); + const { with_replies: withReplies } = layouts.profile.useSearch(); const location = useLocation(); const { data: account, isUnauthorized } = useAccountLookup(username, true); @@ -80,7 +81,7 @@ const ProfileLayout: React.FC = () => { let activeItem; const pathname = location.pathname.replace(`@${username}/`, ''); - if (pathname.endsWith('/with_replies')) { + if (withReplies) { activeItem = 'replies'; } else if (pathname.endsWith('/media')) { activeItem = 'media';