You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user is in the ProfileView, they can navigate directly to the page of any movie on their favorites list. However, the favorites list is displayed using the same MovieCard component that is used in the MainView. As a result, when the user clicks the "Back" button in the single movie view, they are returned to the homepage (MainView) instead of their ProfileView.
Steps to Reproduce:
Log in to the application.
Navigate to the ProfileView.
Click on a movie from the favorites list.
Click the "Back" button in the single movie view.
Observe that the user is redirected to the homepage (MainView) instead of the ProfileView.
Expected Behavior:
When the "Back" button is clicked in the single movie view, the user should be returned to the ProfileView if they navigated to the movie from there.
Actual Behavior:
The user is returned to the MainView when clicking the "Back" button in the single movie view, regardless of whether they navigated to the movie from the ProfileView.
Proposed Solution
Modify the navigation logic in the single movie view's "Back" button to account for the navigation context (e.g., whether the user came from ProfileView or MainView).
Use React Router's state or query to pass the originating view context when navigating to the single movie view.
Implementation Suggestions:
When navigating to a movie from ProfileView, pass additional context:
samanthasbytes
changed the title
Fix navigation issue: Back button from single movie view redirects to MainView instead of ProfileView
Modularize Back Button Logic
Dec 5, 2024
Issue Description
When a user is in the
ProfileView
, they can navigate directly to the page of any movie on their favorites list. However, the favorites list is displayed using the sameMovieCard
component that is used in theMainView
. As a result, when the user clicks the "Back" button in the single movie view, they are returned to the homepage (MainView
) instead of theirProfileView
.Steps to Reproduce:
ProfileView
.MainView
) instead of theProfileView
.Expected Behavior:
When the "Back" button is clicked in the single movie view, the user should be returned to the
ProfileView
if they navigated to the movie from there.Actual Behavior:
The user is returned to the
MainView
when clicking the "Back" button in the single movie view, regardless of whether they navigated to the movie from theProfileView
.Proposed Solution
state
orquery
to pass the originating view context when navigating to the single movie view.Implementation Suggestions:
useLocation
:handleBack
.Benefits
The text was updated successfully, but these errors were encountered: