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
This commit is contained in:
Piotr Myśliński
2026-03-14 13:03:44 +01:00
parent 2135543bc7
commit 34663552b9
2 changed files with 5 additions and 1 deletions

View File

@ -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,

View File

@ -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';