From 91dfab3f4b09c79ac297a043bf049ad898ee590f Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 29 Sep 2026 21:55:03 +0200 Subject: [PATCH] fix(planner): hand the day plan's unawaited calls to void Sonar counts a promise that is neither awaited nor caught as a reliability bug, and it reads every such call in a touched file as new. Each of these already reports its own failure (toast, rollback or the sheet's catch), so they are marked as fire and forget rather than changed. --- .../components/Map/useTripRouteOverview.ts | 2 +- .../src/components/Planner/DayPlanSidebar.tsx | 50 +++++++++---------- .../screens/trip/sheets/MReservationSheet.tsx | 2 +- .../trip/sheets/MTransportFormSheet.tsx | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/client/src/components/Map/useTripRouteOverview.ts b/client/src/components/Map/useTripRouteOverview.ts index 99b7771fc..d35e52421 100644 --- a/client/src/components/Map/useTripRouteOverview.ts +++ b/client/src/components/Map/useTripRouteOverview.ts @@ -104,7 +104,7 @@ export function useTripRouteOverview( if (!loading && reframe) frameRef.current = { tripId, points: next.focusPoints } setResult({ ...next, focusPoints: loading ? frame : frameRef.current!.points, loading }) } - routeTripLegs(plan, { tripId, signal: controller.signal, onAnswer: routed => publish(routed, true) }) + void routeTripLegs(plan, { tripId, signal: controller.signal, onAnswer: routed => publish(routed, true) }) .then(routed => publish(routed, false)) return () => controller.abort() diff --git a/client/src/components/Planner/DayPlanSidebar.tsx b/client/src/components/Planner/DayPlanSidebar.tsx index 16ef1d8f7..64360b0da 100644 --- a/client/src/components/Planner/DayPlanSidebar.tsx +++ b/client/src/components/Planner/DayPlanSidebar.tsx @@ -733,7 +733,7 @@ function useDayPlanSidebar(props: DayPlanSidebarProps) { const controller = new AbortController() legsAbortRef.current = controller - ;(async () => { + void (async () => { const legsByDay: Record> = {} const hotelByDay: Record = {} @@ -1548,7 +1548,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP } assignmentsApi.updateTransport(tripId, assignmentId, mode).catch((err: unknown) => { toast.error(err instanceof Error ? err.message : t('common.unknownError')) - tripActions.refreshDays(tripId) + void tripActions.refreshDays(tripId) }) } @@ -1560,7 +1560,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP onSetRouteProfile?.(mode) daysApi.updateTransport(tripId, dayId, mode).catch((err: unknown) => { toast.error(err instanceof Error ? err.message : t('common.unknownError')) - tripActions.refreshDays(tripId) + void tripActions.refreshDays(tripId) }) } @@ -1603,7 +1603,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP } assignmentsApi.updateTransport(tripId, assignmentId, mode, 'incoming').catch((err: unknown) => { toast.error(err instanceof Error ? err.message : t('common.unknownError')) - tripActions.refreshDays(tripId) + void tripActions.refreshDays(tripId) }) } @@ -1970,15 +1970,15 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP const r = reservations.find(x => x.id === Number(fromReservationId)) if (r) { const update = computeMultiDayMove(r, day.id, phase); tripActions.updateReservation(tripId, r.id, update).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } } else if (fromReservationId) { - handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'transport', transportId, isAfter, toLegIndex) + void handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'transport', transportId, isAfter, toLegIndex) } else if (assignmentId && fromDayId !== day.id) { moveToDay(Number(assignmentId), fromDayId, day.id).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } else if (assignmentId) { - handleMergedDrop(day.id, 'place', Number(assignmentId), 'transport', transportId, isAfter, toLegIndex) + void handleMergedDrop(day.id, 'place', Number(assignmentId), 'transport', transportId, isAfter, toLegIndex) } else if (noteId && fromDayId !== day.id) { tripActions.moveDayNote(tripId, fromDayId, day.id, Number(noteId)).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } else if (noteId) { - handleMergedDrop(day.id, 'note', Number(noteId), 'transport', transportId, isAfter, toLegIndex) + void handleMergedDrop(day.id, 'note', Number(noteId), 'transport', transportId, isAfter, toLegIndex) } setDraggingId(null); setDropTargetKey(null); dragDataRef.current = null; window.__dragData = null return @@ -2006,9 +2006,9 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP if (m.length === 0) return const lastItem = m[m.length - 1] if (assignmentId && String(lastItem?.data?.id) !== assignmentId) - handleMergedDrop(day.id, 'place', Number(assignmentId), lastItem.type, lastItem.data.id, true) + void handleMergedDrop(day.id, 'place', Number(assignmentId), lastItem.type, lastItem.data.id, true) else if (noteId && String(lastItem?.data?.id) !== noteId) - handleMergedDrop(day.id, 'note', Number(noteId), lastItem.type, lastItem.data.id, true) + void handleMergedDrop(day.id, 'note', Number(noteId), lastItem.type, lastItem.data.id, true) }} > {hotelLegs[day.id]?.top && (() => { @@ -2102,7 +2102,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP return } } - applyMergedOrder(day.id, newOrder) + void applyMergedOrder(day.id, newOrder) } const moveUp = (e) => { e.stopPropagation(); arrowMove('up') } const moveDown = (e) => { e.stopPropagation(); arrowMove('down') } @@ -2155,12 +2155,12 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP if (r) { const update = computeMultiDayMove(r, day.id, phase); tripActions.updateReservation(tripId, r.id, update).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } setDraggingId(null); setDropTargetKey(null); dragDataRef.current = null } else if (fromReservationId) { - handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'place', assignment.id) + void handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'place', assignment.id) } else if (fromAssignmentId && fromDayId !== day.id) { moveToDay(Number(fromAssignmentId), fromDayId, day.id, storedPositionBefore(day.id, assignment)).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) setDraggingId(null); setDropTargetKey(null); dragDataRef.current = null } else if (fromAssignmentId) { - handleMergedDrop(day.id, 'place', Number(fromAssignmentId), 'place', assignment.id) + void handleMergedDrop(day.id, 'place', Number(fromAssignmentId), 'place', assignment.id) } else if (noteId && fromDayId !== day.id) { const tm = getMergedItems(day.id) const toIdx = tm.findIndex(i => i.type === 'place' && i.data.id === assignment.id) @@ -2168,7 +2168,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP tripActions.moveDayNote(tripId, fromDayId, day.id, Number(noteId), so).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) setDraggingId(null); setDropTargetKey(null); dragDataRef.current = null } else if (noteId) { - handleMergedDrop(day.id, 'note', Number(noteId), 'place', assignment.id) + void handleMergedDrop(day.id, 'note', Number(noteId), 'place', assignment.id) } }} ref={el => { @@ -2506,15 +2506,15 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP const r2 = reservations.find(x => x.id === Number(fromReservationId)) if (r2) { const update = computeMultiDayMove(r2, day.id, phase); tripActions.updateReservation(tripId, r2.id, update).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } } else if (fromReservationId) { - handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'transport', res.id, insertAfter, res.__leg?.index ?? null) + void handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'transport', res.id, insertAfter, res.__leg?.index ?? null) } else if (fromAssignmentId && fromDayId !== day.id) { moveToDay(Number(fromAssignmentId), fromDayId, day.id).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } else if (fromAssignmentId) { - handleMergedDrop(day.id, 'place', Number(fromAssignmentId), 'transport', res.id, insertAfter, res.__leg?.index ?? null) + void handleMergedDrop(day.id, 'place', Number(fromAssignmentId), 'transport', res.id, insertAfter, res.__leg?.index ?? null) } else if (noteId && fromDayId !== day.id) { tripActions.moveDayNote(tripId, fromDayId, day.id, Number(noteId)).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } else if (noteId) { - handleMergedDrop(day.id, 'note', Number(noteId), 'transport', res.id, insertAfter, res.__leg?.index ?? null) + void handleMergedDrop(day.id, 'note', Number(noteId), 'transport', res.id, insertAfter, res.__leg?.index ?? null) } setDraggingId(null); setDropTargetKey(null); dragDataRef.current = null; window.__dragData = null }} @@ -2672,7 +2672,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP if (r) { const update = computeMultiDayMove(r, day.id, phase); tripActions.updateReservation(tripId, r.id, update).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) } setDraggingId(null); setDropTargetKey(null); dragDataRef.current = null } else if (fromReservationId) { - handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'note', note.id) + void handleMergedDrop(day.id, 'transport', Number(fromReservationId), 'note', note.id) } else if (fromNoteId && fromDayId !== day.id) { const tm = getMergedItems(day.id) const toIdx = tm.findIndex(i => i.type === 'note' && i.data.id === note.id) @@ -2680,12 +2680,12 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP tripActions.moveDayNote(tripId, fromDayId, day.id, Number(fromNoteId), so).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) setDraggingId(null); setDropTargetKey(null) } else if (fromNoteId && fromNoteId !== String(note.id)) { - handleMergedDrop(day.id, 'note', Number(fromNoteId), 'note', note.id) + void handleMergedDrop(day.id, 'note', Number(fromNoteId), 'note', note.id) } else if (fromAssignmentId && fromDayId !== day.id) { moveToDay(Number(fromAssignmentId), fromDayId, day.id, storedPositionBefore(day.id, placeBelowNote(day.id, note.id))).catch((err: unknown) => toast.error(err instanceof Error ? err.message : t('common.unknownError'))) setDraggingId(null); setDropTargetKey(null) } else if (fromAssignmentId) { - handleMergedDrop(day.id, 'place', Number(fromAssignmentId), 'note', note.id) + void handleMergedDrop(day.id, 'place', Number(fromAssignmentId), 'note', note.id) } }} onContextMenu={canEditDays ? e => ctxMenu.open(e, [ @@ -2746,8 +2746,8 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP )} {canEditDays &&
- - + +
} {canEditDays && ( @@ -2943,7 +2943,7 @@ const DayPlanSidebar = React.memo(function DayPlanSidebar(props: DayPlanSidebarP // Close the edit modal behind the confirm; leaving it open would go on // editing a note that no longer exists. cancelNote(pendingDeleteNote.dayId) - deleteNote(pendingDeleteNote.dayId, pendingDeleteNote.noteId) + void deleteNote(pendingDeleteNote.dayId, pendingDeleteNote.noteId) }} title={t('dayplan.confirmDeleteNoteTitle')} message={t('dayplan.confirmDeleteNoteBody')} diff --git a/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx b/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx index 35332e14a..c712b50c2 100644 --- a/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MReservationSheet.tsx @@ -602,7 +602,7 @@ export default function MReservationSheet({ planner, onOpenExpense }: MReservati canUploadFiles={canUploadFiles} showCosts={isBudgetEnabled} createDisabled={!form.title.trim() || isSaving} - onCreate={() => { expenseIntentRef.current = true; handleSubmit() }} + onCreate={() => { expenseIntentRef.current = true; void handleSubmit() }} onEdit={item => onOpenExpense({ editItem: item })} /> diff --git a/client/src/mobile/screens/trip/sheets/MTransportFormSheet.tsx b/client/src/mobile/screens/trip/sheets/MTransportFormSheet.tsx index 7191e0611..2bf294392 100644 --- a/client/src/mobile/screens/trip/sheets/MTransportFormSheet.tsx +++ b/client/src/mobile/screens/trip/sheets/MTransportFormSheet.tsx @@ -1086,7 +1086,7 @@ export default function MTransportFormSheet({ planner, onOpenExpense }: MTranspo canUploadFiles={canUploadFiles} showCosts={isBudgetEnabled} createDisabled={!form.title.trim() || isSaving} - onCreate={() => { expenseIntentRef.current = true; handleSubmit() }} + onCreate={() => { expenseIntentRef.current = true; void handleSubmit() }} onEdit={item => onOpenExpense({ editItem: item })} />