Problem
The calendar selected-day preparation prefetch loads preparation durations one schedule at a time. For a selected day with N uncached schedules, the app performs N sequential preparation requests before the duration map is fully populated. This can make busy calendar days feel slow and creates avoidable API chatter.
Evidence
MonthlySchedulesBloc requests preparation prefetch for the visible date after schedule loads and visible-date changes.
- The prefetch handler filters missing schedule IDs, then loops through them serially with
await inside the loop.
- Each loop iteration calls
LoadPreparationByScheduleIdUseCase, which delegates to PreparationRepository.getPreparationByScheduleId(scheduleId).
PreparationRepositoryImpl.getPreparationByScheduleId performs a remote fetch per schedule ID and publishes the result to the preparation stream.
- The remote data source maps each schedule ID to one HTTP GET via
/schedules/{scheduleId}/preparations.
Proposed direction
Add a bulk preparation-loading path for selected-day schedules. Preferred: expose a backend/API batch endpoint that accepts multiple schedule IDs and returns preparation durations or preparation steps keyed by schedule ID, then add repository/use-case support that updates the existing preparation stream/cache in one operation.
If backend batching is not immediately available, reduce frontend latency by fetching missing IDs concurrently with per-ID error isolation, preserving the current behavior where failed preparation loads are ignored and fallback UI remains available.
Acceptance criteria
- Selecting a day with multiple uncached schedules no longer performs serial per-schedule preparation loading.
- The selected-day prefetch path issues either one batch request or concurrent bounded requests instead of awaiting each schedule ID in sequence.
- Existing cache behavior is preserved: already-loaded schedule preparation durations are not refetched.
- Partial failures still do not fail the whole calendar day; successful preparation durations are shown and failed ones keep fallback UI.
- Tests cover multi-schedule selected-day prefetch, cached IDs, and partial failure behavior.
Source: Codex codebase audit on 2026-06-28.
Problem
The calendar selected-day preparation prefetch loads preparation durations one schedule at a time. For a selected day with N uncached schedules, the app performs N sequential preparation requests before the duration map is fully populated. This can make busy calendar days feel slow and creates avoidable API chatter.
Evidence
MonthlySchedulesBlocrequests preparation prefetch for the visible date after schedule loads and visible-date changes.awaitinside the loop.LoadPreparationByScheduleIdUseCase, which delegates toPreparationRepository.getPreparationByScheduleId(scheduleId).PreparationRepositoryImpl.getPreparationByScheduleIdperforms a remote fetch per schedule ID and publishes the result to the preparation stream./schedules/{scheduleId}/preparations.Proposed direction
Add a bulk preparation-loading path for selected-day schedules. Preferred: expose a backend/API batch endpoint that accepts multiple schedule IDs and returns preparation durations or preparation steps keyed by schedule ID, then add repository/use-case support that updates the existing preparation stream/cache in one operation.
If backend batching is not immediately available, reduce frontend latency by fetching missing IDs concurrently with per-ID error isolation, preserving the current behavior where failed preparation loads are ignored and fallback UI remains available.
Acceptance criteria
Source: Codex codebase audit on 2026-06-28.