Merge pull request #537 from pmysl/tab-highlight-fix

nicolium: respect `with_replies` search param when selecting active tab
This commit is contained in:
nicole mikołajczyk
2026-03-14 13:35:15 +01:00
committed by GitHub
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';