CodingNic

Add Location & User Interactions

Keep Search and Location Flows Consistent

Add Location & User Interactions 10 min read

Keep Search and Location Flows Consistent

Task

Make both interaction paths use the same loading/error/data pipeline.

File / section

src/App.jsx

Change

Do not duplicate fetch/parsing logic inside useLocation. Build the URL there, then call loadWeather(url). Search should do the same.

Why this change matters

One request function prevents the two entry points from drifting apart when error handling or forecast loading changes.

Test it

Search for a city, then use location. Confirm both show the same loader and update the same dashboard sections.

Checkpoint

Search and geolocation now behave as two inputs to one weather-loading flow.