feat(CHIM-620): migrate navigation and routing to IonReactHashRouter#4693
feat(CHIM-620): migrate navigation and routing to IonReactHashRouter#4693manish7321 wants to merge 6 commits into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Code Review
This pull request refactors the application's routing to support hash-based routing by replacing IonReactRouter and BrowserRouter with IonReactHashRouter, introducing a centralized routerLocation utility to handle pathnames and search parameters, and updating history navigation calls to use parsePath. Feedback on these changes highlights a missing React import in AppContent.tsx, a potential invalid URL construction when appending query parameters in LiveQuizGame.tsx, and an unsafe iteration over localStorage during deletion in DataClear.tsx.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| @@ -0,0 +1,53 @@ | |||
| import { IonRouterOutlet } from '@ionic/react'; | |||
There was a problem hiding this comment.
| history.replace({ | ||
| ...parsePath(fromPath + '&isReload=false'), | ||
| state: returnState, | ||
| }); |
There was a problem hiding this comment.
Blindly appending &isReload=false to fromPath can result in an invalid URL path (e.g., /home&isReload=false) if fromPath does not already contain query parameters.\n\nPlease check if fromPath contains ? and use the appropriate separator (? or &) to construct the path, similar to how it is handled in LidoPlayer.tsx.
const separator = fromPath.includes('?') ? '&' : '?';\n history.replace({\n ...parsePath("${fromPath}${separator}isReload=false"),\n state: returnState,\n });
| for (let i = localStorage.length - 1; i >= 0; i--) { | ||
| const key = localStorage.key(i); | ||
| if (key && !KEYS_TO_PRESERVE.has(key)) { | ||
| localStorage.removeItem(key); | ||
| } | ||
| } |
There was a problem hiding this comment.
Iterating backwards over localStorage while calling removeItem can lead to skipped keys or unexpected behavior. According to the HTML Storage specification, the order of keys is implementation-defined and only guaranteed to be consistent as long as the number of keys does not change. Mutating the storage during iteration changes the key indices dynamically.\n\nTo ensure robust and safe deletion, collect all keys into an array first, and then iterate over that array to remove the non-preserved keys.
const keys: string[] = [];\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key) {\n keys.push(key);\n }\n }\n for (const key of keys) {\n if (!KEYS_TO_PRESERVE.has(key)) {\n localStorage.removeItem(key);\n }\n }
f8ec50f to
db03d07
Compare
Move app routing/content into AppContent and simplify App bootstrap. Switch from the legacy GrowthBook API to useFeatureValue across pages/hooks to read the GENERIC_POP_UP feature. Add URL building for hash vs non-hash routers and update replaceLocation to respect app routing. Fix GenericPopUp behavior (isPopupActive lifecycle) and broaden PopupConfig typing to include JSONValue. Clean up DataClear and Sidebar localStorage handling. Update tests and mocks to match router and GrowthBook changes. Files changed: App.tsx, app/AppContent.tsx, hooks/useGenericPopup.ts, pages/*, components/GenericPopUp/*, navigation utilities, tests and mocks. Why: reduces bootstrap complexity, unifies feature-flag usage, fixes popup navigation issues, and aligns tests with hash routing.
ce81256 to
d3073d6
Compare
What
Migrates app navigation from BrowserRouter/IonReactRouter assumptions to IonReactHashRouter and updates related routing behavior across the app.
This includes:
Why
The app was being migrated to Ionic hash-based routing, but many flows still assumed browser-style paths and legacy stateful navigation
behavior.
That caused risk of broken or inconsistent:
How
Testing
QRAssignments, and TeacherRecommendedAssignments.
Risks