Skip to content

Commit 0da9949

Browse files
committed
RD-T42 PR#113 fixes
1 parent 7a3d73f commit 0da9949

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/app/(app)/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function DispatchConsole() {
4545
const { units, isLoading: unitsLoading, fetchUnits } = useUnitsStore();
4646
const { personnel, isLoading: personnelLoading, fetchPersonnel } = usePersonnelStore();
4747
const { notes, isLoading: notesLoading, fetchNotes } = useNotesStore();
48-
const { lastUpdateTimestamp, lastPersonnelUpdateTimestamp, lastUnitsUpdateTimestamp, lastCallsUpdateTimestamp, lastEventType } = useSignalRStore();
48+
const { lastPersonnelUpdateTimestamp, lastUnitsUpdateTimestamp, lastCallsUpdateTimestamp, lastEventType } = useSignalRStore();
4949
const { userId } = useAuthStore();
5050

5151
// Weather alerts

src/stores/callVideoFeeds/store.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,19 @@ export const useCallVideoFeedsStore = create<CallVideoFeedsState>((set, get) =>
7474

7575
removeFeed: async (feedId: string, callId: string) => {
7676
// Optimistic removal
77-
set({ feeds: get().feeds.filter((f) => f.CallVideoFeedId !== feedId) });
77+
set({ feeds: get().feeds.filter((f) => f.CallVideoFeedId !== feedId), error: null });
7878
try {
7979
await deleteCallVideoFeed(feedId);
8080
return true;
8181
} catch (error) {
8282
logger.error({ message: 'Failed to delete video feed', context: { error, feedId } });
83+
set({ error: error instanceof Error ? error.message : 'Failed to delete video feed' });
8384
// Re-sync from server instead of reverting a potentially stale snapshot
84-
await get().fetchFeeds(callId).catch(() => {});
85+
try {
86+
await get().fetchFeeds(callId);
87+
} catch {
88+
// fetchFeeds handles its own error state; nothing else to do here
89+
}
8590
return false;
8691
}
8792
},

src/stores/checkIn/store.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const useCheckInStore = create<CheckInState>((set, get) => ({
169169

170170
fetchTimerStatusesForCalls: async (callIds: number[]) => {
171171
if (callIds.length === 0) {
172-
set({ timerStatuses: [], isLoadingStatuses: false });
172+
set({ timerStatuses: [], resolvedTimers: [], isLoadingStatuses: false, statusError: null });
173173
return;
174174
}
175175
set({ isLoadingStatuses: true, statusError: null });
@@ -181,7 +181,7 @@ export const useCheckInStore = create<CheckInState>((set, get) => ({
181181
const allResolved = resolvedResults.flatMap((r) => r.Data || []);
182182
const enriched = enrichTimerNames(statusResult.Data || [], allResolved);
183183
const sorted = enriched.sort(sortByStatusSeverity);
184-
set({ timerStatuses: sorted, isLoadingStatuses: false });
184+
set({ timerStatuses: sorted, resolvedTimers: allResolved, isLoadingStatuses: false });
185185
} catch (error) {
186186
set({
187187
statusError: error instanceof Error ? error.message : 'Failed to fetch timer statuses',
@@ -258,8 +258,11 @@ export const useCheckInStore = create<CheckInState>((set, get) => ({
258258
if (existing) {
259259
clearInterval(existing);
260260
}
261+
if (callIds.length === 0) {
262+
set({ _pollingInterval: null, _pollingCallIds: [] });
263+
return;
264+
}
261265
set({ _pollingCallIds: callIds });
262-
if (callIds.length === 0) return;
263266
const interval = setInterval(() => {
264267
get().fetchTimerStatusesForCalls(callIds);
265268
}, intervalMs);

0 commit comments

Comments
 (0)