Skip to content

Commit

Permalink
fix: clear state after logout
Browse files Browse the repository at this point in the history
  • Loading branch information
devrsi0n committed Apr 25, 2024
1 parent 809af11 commit a05120d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/ui/src/blocks/notification-hub/notification-hub.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { trpc } from '@chirpy-dev/trpc/src/client';
import clsx from 'clsx';
import * as React from 'react';

import { Heading } from '../../components/heading';
Expand All @@ -7,6 +8,7 @@ import { Menu } from '../../components/menu';
import { Spinner } from '../../components/spinner';
import { Text } from '../../components/text';
import { useCurrentUser } from '../../contexts/current-user-context';
import { useIsWidget } from '../../hooks';
import styles from './notification-hub.module.scss';
import { NotificationItem } from './notification-item';

Expand All @@ -26,6 +28,7 @@ export function NotificationHub(): JSX.Element {
const { mutateAsync: deleteNotificationMessage } =
trpc.notification.delete.useMutation();
const hasUnreadNotifications = data?.some((msg) => !msg.read);
const isWidget = useIsWidget();
return (
<div className="mr-4 flex flex-row items-center justify-center">
<Menu>
Expand All @@ -47,7 +50,12 @@ export function NotificationHub(): JSX.Element {
<Spinner className="absolute right-0 pr-6 pt-2"> </Spinner>
)}
{data && (data?.length || 0) > 0 ? (
<div className="max-h-96 w-max overflow-y-auto">
<div
className={clsx(
'w-max overflow-y-auto',
isWidget ? 'max-h-[20rem]' : 'max-h-96',
)}
>
{data.map((msg, index) => (
<NotificationItem
key={msg.id}
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/blocks/user-menu/user-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ export function UserMenu(props: UserMenuProps): JSX.Element {
await signOut({
redirect: !isWidget,
});
if (isWidget) {
location.reload();
}
}}
>
<IconLogOut size={14} />
Expand Down

0 comments on commit a05120d

Please sign in to comment.