diff --git a/resources/js/pages/notification/index.tsx b/resources/js/pages/notification/index.tsx
index eb2a90e3f4..26d7040e51 100644
--- a/resources/js/pages/notification/index.tsx
+++ b/resources/js/pages/notification/index.tsx
@@ -158,9 +158,14 @@ export default function Index({
const { start, stop } = usePoll(
30_000,
() => ({
- only: ['notifications', 'auth.unreadNotificationsCount'],
+ only: [
+ 'notifications',
+ 'auth.unreadNotificationsCount',
+ 'auth.unreadMessagesCount',
+ ],
reset: ['notifications'],
data: {
+ type: filters.type,
cursor: '',
through: notifications.data.at(-1)?.created_at,
},
@@ -364,6 +369,7 @@ export default function Index({
<>
+import assert from 'node:assert/strict';
+import type { ReactNode } from 'react';
+import { renderToString } from 'react-dom/server';
+import { test, vi } from 'vite-plus/test';
+import { TooltipProvider } from '../../resources/js/components/ui/tooltip';
+import type { NotificationGroup, User } from '../../resources/js/types';
+
+let poll: () => { only?: string[]; data?: Record };
+let scrollParams: { data?: Record } | undefined;
+
+vi.doMock('@inertiajs/react', async () => ({
+ ...(await vi.importActual('@inertiajs/react')),
+ usePoll: (_interval: number, options: typeof poll) => {
+ poll = options;
+
+ return { start: () => {}, stop: () => {} };
+ },
+ InfiniteScroll: ({
+ params,
+ children,
+ }: {
+ params?: typeof scrollParams;
+ children: ReactNode;
+ }) => {
+ scrollParams = params;
+
+ return children;
+ },
+}));
+
+const { createInertiaApp } = await import('@inertiajs/react');
+const { default: Index } =
+ await import('../../resources/js/pages/notification/index');
+
+const timestamp = '2026-10-16T12:00:00Z';
+const actor: User = {
+ id: 'actor',
+ username: 'follower',
+ name: 'Follower',
+ avatar_url: null,
+ bio: null,
+ location: null,
+ website: null,
+ company: null,
+ has_sponsors_listing: false,
+ timezone: null,
+ has_github_account: true,
+ lane: 0,
+ created_at: timestamp,
+ updated_at: timestamp,
+};
+const follow: NotificationGroup = {
+ id: 'notice',
+ recipient_id: 'recipient',
+ actor_id: actor.id,
+ commit_id: null,
+ subject_id: null,
+ reason: null,
+ read_at: timestamp,
+ group_id: 'notice',
+ type: 'followed',
+ actor: { ...actor, is_followed: false },
+ actors: [actor],
+ actors_count: 1,
+ event_count: 1,
+ unread_count: 0,
+ created_at: timestamp,
+ updated_at: timestamp,
+ commit: null,
+};
+
+await createInertiaApp({
+ page: {
+ component: 'notification/index',
+ props: {
+ auth: { user: { id: 'recipient', username: 'recipient' }, log: {} },
+ errors: {},
+ },
+ url: '/notifications',
+ version: null,
+ clearHistory: false,
+ encryptHistory: false,
+ rescuedProps: [],
+ rememberedState: {},
+ flash: {},
+ },
+ resolve: () => () => (
+
+ ),
+ render: renderToString,
+ setup: ({ App, props }) => (
+
+
+
+ ),
+});
+
+test('polls and loads more with the filter on screen', () => {
+ assert.equal(poll().data?.type, 'follows');
+ assert.equal(scrollParams?.data?.type, 'follows');
+});
+
+test('keeps the messages badge current while the layout poller is off', () => {
+ assert.ok(poll().only?.includes('auth.unreadMessagesCount'));
+});
diff --git a/tests/draft-images.config.ts b/tests/draft-images.config.ts
index 4170077549..5085a5264b 100644
--- a/tests/draft-images.config.ts
+++ b/tests/draft-images.config.ts
@@ -23,6 +23,7 @@ export default defineConfig({
'tests/Unit/SearchDialogComposition.test.tsx',
'tests/Unit/ReportResolution.test.tsx',
'tests/Unit/LinkifiedText.test.tsx',
+ 'tests/Unit/NotificationPoll.test.tsx',
],
},
});
diff --git a/tests/tsconfig.json b/tests/tsconfig.json
index 5390d6411f..d18cae9301 100644
--- a/tests/tsconfig.json
+++ b/tests/tsconfig.json
@@ -11,6 +11,7 @@
"Unit/SearchDialogComposition.test.tsx",
"Unit/DraftImageReads.test.tsx",
"Unit/ImageAttachments.test.tsx",
+ "Unit/NotificationPoll.test.tsx",
"../resources/js/types/*.d.ts",
"draft-images.config.ts"
]