Skip to content

Commit

Permalink
[docs] Fix the notification display logic (mui#28389)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Sep 16, 2021
1 parent ac5b87d commit a8eb649
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/notifications.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
},
{
"id": 54,
"text": "<a style=\"color: inherit;\" target=\"_blank\" rel=\"noopener\" href=\"https://twitter.com/MaterialUI/status/1438518915236126723\">MUI Core v5 is out 🎉</a>"
"text": "<a style=\"color: inherit;\" target=\"_blank\" rel=\"noopener\" href=\"https://twitter.com/MaterialUI/status/1438518915236126723\">MUI Core v5</a> is out 🎉"
}
]
2 changes: 1 addition & 1 deletion docs/src/modules/components/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function Notifications() {
.then((newMessages) => {
if (active) {
const seen = getCookie('lastSeenNotification');
const lastSeenNotification = seen === '' ? 0 : parseInt(seen, 10);
const lastSeenNotification = seen === undefined ? 0 : parseInt(seen, 10);
setNotifications({
messages: newMessages || [],
lastSeen: lastSeenNotification,
Expand Down
4 changes: 1 addition & 3 deletions docs/src/modules/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ export function getDependencies(
* @return The cookie value
*/
export function getCookie(name: string): string | undefined {
// `process.browser` is set by nextjs where we only use `getCookie`
// but this file is imported from nodejs scripts so TypeScript complains for that environment.
if ((process as any).browser) {
if (typeof document !== 'undefined') {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) {
Expand Down

0 comments on commit a8eb649

Please sign in to comment.