-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: persist scroll position on page navigation #1778
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This pull request aims to persist the scroll position on page navigation in the purchased course videos tab so that users return to their previous position when navigating back from a video.
- Restores the scroll position from sessionStorage on component mount.
- Debounces scroll event updates and cleans up listeners on unmount.
Reviewed Changes
File | Description |
---|---|
src/components/ContentCard.tsx | Integrates scroll persistence logic via useEffect and sessionStorage. |
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
src/components/ContentCard.tsx
Outdated
@@ -37,6 +38,28 @@ export const ContentCard = ({ | |||
uploadDate?: string; | |||
weeklyContentTitles?: string[]; | |||
}) => { | |||
const scrollTimeoutRef = useRef<NodeJS.Timeout | null>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Embedding scroll persistence logic in the ContentCard component may lead to multiple event listeners being added if multiple cards are rendered on the page. Consider moving this logic to a higher-level component or creating a custom hook to handle scroll position management in a single place.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with the changes
@devsargam done with the changes sir ! if it's fine merge it and make as one commit |
Issue: you will see bunch of videos when you open a purchased course, if you scroll to some video like 14th or 15 or to end and opens it and return back you will got to see the scroll position to 0. Again you need to scroll to open a neighbour video of previous one.
PR Fixes:
Resolves #[Issue Number if there]
Checklist before requesting a review