Skip to content

Commit 05c79d9

Browse files
committed
loading state fix
1 parent d80be86 commit 05c79d9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

frontend/src/components/NotificationCenter.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
import { isAuthenticated, username, userId } from '../stores/auth';
55
import { get } from 'svelte/store';
66
import { goto } from '@mateothegreat/svelte5-router';
7-
import { notificationStore, notifications, unreadCount } from '../stores/notificationStore';
7+
import { notificationStore, notifications, unreadCount, loading } from '../stores/notificationStore';
88
import type { NotificationResponse } from '../lib/api';
99
1010
let showDropdown = $state(false);
11-
let loading = $state(false);
1211
// EventSource and reconnect state - not displayed in template, no $state needed
1312
let eventSource: EventSource | null = null;
1413
let reconnectAttempts = 0;
@@ -246,7 +245,7 @@
246245
</div>
247246

248247
<div class="max-h-96 overflow-y-auto">
249-
{#if loading}
248+
{#if $loading}
250249
<div class="p-8 text-center">
251250
<span class="loading loading-spinner loading-sm"></span>
252251
</div>

frontend/src/stores/notificationStore.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ function createNotificationStore() {
9999
export const notificationStore = createNotificationStore();
100100
export const unreadCount = derived(notificationStore, s => s.notifications.filter(n => n.status !== 'read').length);
101101
export const notifications = derived(notificationStore, s => s.notifications);
102+
export const loading = derived(notificationStore, s => s.loading);

0 commit comments

Comments
 (0)