From 87f38fec9e60e9234882860afc8ff951c77ff5d2 Mon Sep 17 00:00:00 2001 From: gnezim Date: Sat, 18 Apr 2026 19:12:59 +0300 Subject: [PATCH] Skip useOnlineBoard fetch when dateFrom/dateTo are empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Details page calls useOnlineBoard to populate the sibling mini-list, passing empty-string params when the URL has no ?request=... context. The empty params were reaching the backend as dateFrom=&dateTo=, which returns HTTP 400 and surfaces as an error in the browser console. Short-circuit the effect so we just emit an empty result when either range bound is missing — same no-fetch behavior, no console noise. --- src/features/online-board/hooks/useOnlineBoard.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/features/online-board/hooks/useOnlineBoard.ts b/src/features/online-board/hooks/useOnlineBoard.ts index fe9bbb6c..ce2bf477 100644 --- a/src/features/online-board/hooks/useOnlineBoard.ts +++ b/src/features/online-board/hooks/useOnlineBoard.ts @@ -43,6 +43,17 @@ export function useOnlineBoard( }, []); useEffect(() => { + // Callers pass empty strings when the search context isn't resolved + // yet (e.g. details page with no `?request=...`). Skip the fetch + // rather than sending `dateFrom=&dateTo=` — the backend rejects that + // with HTTP 400 and it shows up as an error in the browser console. + if (!params.dateFrom || !params.dateTo) { + setFlights([]); + setLoading(false); + setError(null); + return; + } + let cancelled = false; setLoading(true); setError(null);