@@ -21,7 +21,7 @@ import ConnectedLinks from './common/connected-links';
2121import Footer from './footer' ;
2222
2323import dynamic from 'next/dynamic' ;
24- import NotificationPanel , { lastMessageId } from './notification-panel' ;
24+ import NotificationPanel , { lastMessageId , oldestMessageId } from './notification-panel' ;
2525const DocSearch = dynamic ( import ( './docsearch' ) , {
2626 ssr : false
2727} ) ;
@@ -126,7 +126,7 @@ const Layout = ({ children }) => {
126126 const searchRef = useRef ( null ) ;
127127 const anchorRef = useRef ( null ) ;
128128 const [ openNotification , setOpenNotifiation ] = useState ( false ) ;
129- const [ lastCheck , setLastCheck ] = useState ( '' ) ;
129+ const [ lastCheck , setLastCheck ] = useState ( lastMessageId ) ;
130130
131131 useEffect ( ( ) => {
132132 setLinks ( findConnectedLinks ( router . asPath , flatSchema ) || { } ) ;
@@ -189,7 +189,7 @@ const Layout = ({ children }) => {
189189 >
190190 < DocSearch />
191191 < 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" >
193193 < NotificationsIcon className = { classes . menuIcons } />
194194 </ Badge >
195195 </ IconButton >
0 commit comments