Fix mobile menu not closing when clicking See all notifications

The LinkButton component wasn't passing onClick to internal Link
components, only to external anchor tags. This prevented the onClose
callback from firing when navigating via the notifications footer link.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Kalle
2026-01-12 17:46:39 +02:00
parent 5e9e7b4804
commit cb254c6e31
4 changed files with 10 additions and 4 deletions

View File

@@ -1,10 +1,11 @@
---
# sendou.ink-ja9h
title: Show all notifications link doesn't close menu on mobile
status: todo
status: completed
type: bug
priority: normal
created_at: 2026-01-11T19:22:01Z
updated_at: 2026-01-11T19:22:01Z
updated_at: 2026-01-12T15:32:45Z
parent: sendou.ink-6eko
---

View File

@@ -495,6 +495,7 @@ function YouPanel({ onClose }: { onClose: () => void }) {
<NotificationContent
notifications={notifications}
unseenIds={unseenIds}
onClose={onClose}
/>
) : null}
</MobilePanel>

View File

@@ -108,6 +108,7 @@ export function LinkButton({
data-testid={testId}
prefetch={prefetch}
preventScrollReset={preventScrollReset}
onClick={onClick}
>
{icon &&
React.cloneElement(icon, {

View File

@@ -39,9 +39,11 @@ export function useNotifications() {
export function NotificationContent({
notifications,
unseenIds,
onClose,
}: {
notifications: LoaderNotification[];
unseenIds: number[];
onClose?: () => void;
}) {
const { t } = useTranslation(["common"]);
const { revalidate, state } = useRevalidator();
@@ -81,13 +83,13 @@ export function NotificationContent({
</NotificationsList>
)}
{notifications.length === NOTIFICATIONS.PEEK_COUNT ? (
<NotificationsFooter />
<NotificationsFooter onClose={onClose} />
) : null}
</>
);
}
function NotificationsFooter() {
function NotificationsFooter({ onClose }: { onClose?: () => void }) {
const { t } = useTranslation(["common"]);
return (
@@ -99,6 +101,7 @@ function NotificationsFooter() {
to={NOTIFICATIONS_URL}
className="mt-1-5"
testId="notifications-see-all-button"
onClick={onClose}
>
{t("common:notifications.seeAll")}
</LinkButton>