Skip to content

Commit 79af98c

Browse files
author
mdatelle
committed
refactor: clean up sidebar typescript errors
1 parent 43b0975 commit 79af98c

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

unraid-ui/src/forms/Select.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const onSelectOpen = () => {
5252
<span v-else>{{ control.schema.default ?? 'Select an option' }}</span>
5353
</SelectTrigger>
5454
<!-- The content includes the selectable options -->
55-
<SelectContent :to="teleportTarget as HTMLElement">
55+
<SelectContent :to="teleportTarget">
5656
<SelectItem v-for="option in options" :key="option.value" :value="option.value">
5757
<SelectItemText>{{ option.label }}</SelectItemText>
5858
</SelectItem>

unraid-ui/stories/components/common/Sheet.stories.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Meta, StoryObj } from '@storybook/vue3';
2-
import { h } from 'vue';
32
import Button from '../../../src/components/common/button/Button.vue';
43
import SheetComponent from '../../../src/components/common/sheet/Sheet.vue';
54
import SheetContent from '../../../src/components/common/sheet/SheetContent.vue';

web/components/Notifications/Sidebar.vue

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ import {
2121
TabsTrigger,
2222
} from '@unraid/ui';
2323
24+
import type {
25+
NotificationAddedSubSubscription,
26+
NotificationOverviewSubSubscription,
27+
OverviewQuery,
28+
} from '~/composables/gql/graphql';
29+
2430
import { useTrackLatestSeenNotification } from '~/composables/api/use-notifications';
2531
import { useFragment } from '~/composables/gql';
2632
import { Importance, NotificationType } from '~/composables/gql/graphql';
@@ -61,16 +67,39 @@ const confirmAndDeleteArchives = async () => {
6167
const { result, subscribeToMore } = useQuery(notificationsOverview);
6268
subscribeToMore({
6369
document: notificationOverviewSubscription,
64-
updateQuery: (prev, { subscriptionData }) => {
70+
updateQuery: (
71+
prev: OverviewQuery,
72+
{ subscriptionData }: { subscriptionData: { data: NotificationOverviewSubSubscription } }
73+
) => {
6574
const snapshot = structuredClone(prev);
66-
snapshot.notifications.overview = subscriptionData.data.notificationsOverview;
75+
const subData = subscriptionData.data.notificationsOverview;
76+
const unreadFragment = subData.unread[' $fragmentRefs']?.NotificationCountFragmentFragment;
77+
const archiveFragment = subData.archive[' $fragmentRefs']?.NotificationCountFragmentFragment;
78+
79+
if (!unreadFragment || !archiveFragment) return snapshot;
80+
81+
snapshot.notifications.overview = {
82+
__typename: 'NotificationOverview',
83+
unread: {
84+
__typename: 'NotificationCounts',
85+
info: unreadFragment.info,
86+
warning: unreadFragment.warning,
87+
alert: unreadFragment.alert,
88+
total: unreadFragment.total,
89+
},
90+
archive: {
91+
__typename: 'NotificationCounts',
92+
total: archiveFragment.total,
93+
},
94+
};
95+
6796
return snapshot;
6897
},
6998
});
7099
const { latestNotificationTimestamp, haveSeenNotifications } = useTrackLatestSeenNotification();
71100
const { onResult: onNotificationAdded } = useSubscription(notificationAddedSubscription);
72101
73-
onNotificationAdded(({ data }) => {
102+
onNotificationAdded(({ data }: { data: NotificationAddedSubSubscription | null }) => {
74103
if (!data) return;
75104
const notif = useFragment(NOTIFICATION_FRAGMENT, data.notificationAdded);
76105
if (notif.type !== NotificationType.Unread) return;

web/nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default defineNuxtConfig({
3333
},
3434

3535
devtools: {
36-
enabled: process.env.NODE_ENV === 'development',
36+
enabled: false,
3737
},
3838

3939
modules: [

0 commit comments

Comments
 (0)