Persist Schedule filter into cross-section store on submit (TZ §4.1.8)
ScheduleFilter's handleSubmit now calls setScheduleFilter with the submitted outbound + optional return snapshot. This completes the cross-section wiring: OnlineBoardFilter already wrote to the store and both start pages read getBoardFilter/getScheduleFilter for Table-10 projection on subsystem switch.
This commit is contained in:
@@ -19,6 +19,7 @@ import { useDictionaries } from "@/shared/dictionaries/index.js";
|
||||
import { useScheduleCalendar } from "../hooks/useScheduleCalendar.js";
|
||||
import type { IScheduleCalendarParams } from "../types.js";
|
||||
import { buildScheduleUrl } from "../url.js";
|
||||
import { setScheduleFilter } from "@/shared/state/crossSectionNavigation.js";
|
||||
import type { ScheduleParams } from "../url.js";
|
||||
import { formatScheduleDateRangeWithCurrentWeek } from "../dateLabels.js";
|
||||
import { scheduleWindowBounds } from "@/shared/dateWindow.js";
|
||||
@@ -374,6 +375,29 @@ export const ScheduleFilter: FC<ScheduleFilterProps> = ({
|
||||
params = { type: "route", outbound };
|
||||
}
|
||||
const url = buildScheduleUrl(params);
|
||||
// TZ §4.1.8: persist Schedule filter into the cross-section
|
||||
// store so a subsequent visit to Board/Schedule within the same
|
||||
// session can read/project it.
|
||||
setScheduleFilter({
|
||||
mode: "route",
|
||||
...(dep ? { departure: dep } : {}),
|
||||
...(arr ? { arrival: arr } : {}),
|
||||
dateFrom: outbound.dateFrom,
|
||||
dateTo: outbound.dateTo,
|
||||
timeFrom: outbound.timeFrom ?? "0000",
|
||||
timeTo: outbound.timeTo ?? "2400",
|
||||
onlyDirect: directOnly,
|
||||
showReturn: returnFlights,
|
||||
...(returnFlights && params.type === "roundtrip"
|
||||
? {
|
||||
returnDateFrom: params.inbound.dateFrom,
|
||||
returnDateTo: params.inbound.dateTo,
|
||||
returnTimeFrom: params.inbound.timeFrom ?? "0000",
|
||||
returnTimeTo: params.inbound.timeTo ?? "2400",
|
||||
}
|
||||
: {}),
|
||||
searchExecuted: true,
|
||||
});
|
||||
// Lock submit for 30 seconds (§4.1.11 — hardcoded, not configurable)
|
||||
setSubmitLockedUntil(Date.now() + 30_000);
|
||||
setNowTs(Date.now());
|
||||
|
||||
Reference in New Issue
Block a user