fix: feed detail and map improved back navigation#76
fix: feed detail and map improved back navigation#76Alessandro100 wants to merge 7 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR improves “Back” navigation behavior on the Feed Detail and Feed Detail Map experiences to avoid exiting the app on direct entry and to make Map → Detail navigation consistent.
Changes:
- Updated the feed detail back button logic to fall back to
/feedswhen there’s no safe in-app history. - Switched map view navigation from
router.pushtorouter.replaceto avoid keeping the map page in the browser history stack.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/app/screens/Feed/components/FullMapView.tsx |
Uses router.replace for map “back/close” actions to prevent returning to the map via browser back. |
src/app/screens/Feed/components/FeedNavigationControls.tsx |
Adds a handleBack helper intended to avoid navigating back out of the app on direct entry. |
Applied guidance: vercel-react-best-practices (custom).
You can also share your feedback on Copilot code review. Take the survey.
| const hasReferrer = document.referrer !== ''; | ||
| const hasSameOriginReferrer = | ||
| hasReferrer && new URL(document.referrer).origin === window.location.origin; | ||
|
|
||
| if (!hasSameOriginReferrer) { | ||
| router.push('/feeds'); | ||
| return; | ||
| } | ||
|
|
|
*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/ * (Desktop)
*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds * (Desktop)
*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-h3ygqt1uo-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
|
closes #41
Summary:
Feed Detail and Feed Detail Map pages have improved "Back" navigation
Expected behavior:
Feed Detail Page
Feed Detail Map Page
Important
Explicitly not handling the functionality of
directly to feed page -> back -> goes to feeds pagedue to the complexities of detecting a direct navigation in SSR. It's possible but adds too much complexity for what it accomplishesTesting tips:
Play around with standard navigation and see if you get expected behaviour. For more precise tests, refere under
GTFS
GTFS RT
Please make sure these boxes are checked before submitting your pull request - thanks!
yarn testto make sure you didn't break anything