implemented url based folder routing - #186
Open
akashroy8210 wants to merge 8 commits into
Open
Conversation
RsbhThakur
requested changes
Aug 8, 2026
RsbhThakur
left a comment
Contributor
There was a problem hiding this comment.
Overall amazing PR, but two minor fixes before we can merge:
- Revert the changes of
client/package-lock.json, it appears some local dev npm install noise to me, definitely not required in the diff and may cause problems. - The navigation is working fine overall but with one major problem: when we are at the root of the course folder then say we go to some folder like
examsand then press the back button - it should again go to the course page root, but instead its doing nothing just changing thehreflink. The navigation inside the subfolders are working fine.
Contributor
Author
|
Fix course root navigation when pressing Back from a subfolder Resolved an issue where pressing the Back button from a subfolder (like exams) changed the browser URL back to the main course page (/browse/:code), but the screen UI remained stuck displaying the subfolder content. Navigating back now correctly updates both the URL and the displayed course page view. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
File Changes & Rationale
client/src/App.jsx
What I Changed: Added flat route paths for /browse, /browse/:code, and /browse/:code/:folderId.
Why: To teach the app to recognize web links that include a folder ID.
client/src/screens/browse/index.jsx
What I Changed: Added code to read :folderId from the URL, automatically update the folder view when the URL changes, and handle invalid links.
Why: So that when a user refreshes the page, opens a shared link, or clicks the browser Back button, the app reads the URL and shows the correct folder.
client/src/screens/browse/components/browsefolder/index.jsx
What I Changed: Updated the folder click handler to run navigate('/browse/:code/:folderId').
Why: So that clicking a folder card updates the browser address bar and creates a step in the browser's Back/Forward history.
client/src/screens/browse/components/collapsible/components/folder/index.jsx
What I Changed: Updated the sidebar folder click handler to run navigate('/browse/:code/:folderId').
Why: So that clicking a folder in the left sidebar menu also updates the browser address bar.
client/src/screens/browse/components/collapsible/index.jsx
What I Changed: Added a check to verify if the searched folder is already active (searchedFolder._id !== currentFolder?._id). If it is already active, do not dispatch the folder change.
Why: Because without this check, useEffect was continuously dispatching folder updates on every render, causing an infinite background loop that crashed the page.