Conversation
When prefixURL is empty, the server injected <base href="./" /> (relative). On nested SPA routes like /recording/135/..., the browser resolved asset paths relative to the current URL, e.g. /recording/135/assets/index.js instead of /assets/index.js, causing a blank page on reload. Remove the special case that converted "/" to "./" so the base href is always absolute.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a critical issue in Single Page Applications (SPAs) where reloading a nested route would result in a blank page due to incorrect asset loading. The change ensures that the injected '' is always an absolute path, preventing browsers from misinterpreting relative asset URLs against the current nested route. This guarantees that all assets load correctly, improving the reliability of SPA routing. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a bug in the Single-Page Application routing where asset paths were resolved incorrectly on nested routes. The change removes logic that converted an absolute base href of / to a relative ./. By ensuring the base href is always absolute (/ when no prefix is given), this fix correctly resolves asset paths from the root of the domain, preventing 404 errors on page reloads. The change is confined to the intended logic and appears correct.
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
Summary
<base href="/" />to<base href="./" />whenprefixURLis empty/recording/135/...Problem
When reloading a page at a nested route (e.g.
/recording/135/MP_COOP_m05_20260228_195209), the browser resolved relative asset paths against the current URL path:./assets/index.js→/recording/135/assets/index.js(404)This happened because the server injected
<base href="./" />(relative) instead of<base href="/" />(absolute).Test plan
/— assets load correctly/recording/<id>/<name>— page renders/recording/<id>/<name>— page still renders (was broken before)prefixURL(e.g./ocap/) that assets still resolve correctly