hasadna/open-bus-map-search

Transport map: typing a time triggers a fetch on every keystroke

Aperta

#1610 aperta il 4 giu 2026

 (3 commenti) (0 reazioni) (0 assegnatari)TypeScript (125 fork)auto 404
frontendgood first issue

Metriche repository

Star
 (95 stelle)
Metriche merge PR
 (Merge medio 6g 5h) (42 PR mergiate in 30 g)

Descrizione

On the transport map page (/map, src/pages/timeBasedMap/index.tsx), every keystroke in the time picker triggers a new data fetch, so typing a time sends a request for each partial value instead of just the final one. Typing 23:55 triggers 4 fetches (02:00, 23:00, 23:05, 23:55), only the last of which matters.

Why it's a problem: it sends many unneeded requests that load the system for no reason, and it hurts the user experience. The user sees the map reload several times and the page feels slower.

Proposed fix: debounce the value that drives the fetch while keeping the picker immediate, using the same pattern already applied to the line search in #38. Uses the existing debounce from es-toolkit/compat, and is contained to timeBasedMap/index.tsx.

Guida contributor