@@ -21,7 +21,7 @@ import ConnectedLinks from './common/connected-links';
21
21
import Footer from './footer' ;
22
22
23
23
import dynamic from 'next/dynamic' ;
24
- import NotificationPanel , { lastMessageId } from './notification-panel' ;
24
+ import NotificationPanel , { lastMessageId , oldestMessageId } from './notification-panel' ;
25
25
const DocSearch = dynamic ( import ( './docsearch' ) , {
26
26
ssr : false
27
27
} ) ;
@@ -126,7 +126,7 @@ const Layout = ({ children }) => {
126
126
const searchRef = useRef ( null ) ;
127
127
const anchorRef = useRef ( null ) ;
128
128
const [ openNotification , setOpenNotifiation ] = useState ( false ) ;
129
- const [ lastCheck , setLastCheck ] = useState ( '' ) ;
129
+ const [ lastCheck , setLastCheck ] = useState ( lastMessageId ) ;
130
130
131
131
useEffect ( ( ) => {
132
132
setLinks ( findConnectedLinks ( router . asPath , flatSchema ) || { } ) ;
@@ -189,7 +189,7 @@ const Layout = ({ children }) => {
189
189
>
190
190
< DocSearch />
191
191
< IconButton aria-label = "show new notifications" onClick = { handleToggle } color = "inherit" ref = { anchorRef } className = { clsx ( classes . menuButton ) } >
192
- < Badge badgeContent = { lastMessageId - lastCheck } color = "secondary" >
192
+ < Badge badgeContent = { lastMessageId - Math . max ( lastCheck , oldestMessageId ) } color = "secondary" >
193
193
< NotificationsIcon className = { classes . menuIcons } />
194
194
</ Badge >
195
195
</ IconButton >
0 commit comments