fix: Avoid error when switching frontend version if it also exists in comment in html-file#4290
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughInline regex-based HTML asset URL mutations in ChangesVersionSwitcher utility extraction and integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/features/devtools/components/VersionSwitcher/versionSwitcherUtils.ts`:
- Around line 4-7: The regex patterns in the replaceFrontendVersion function use
greedy matching with `.*` which can match too much content on minified lines or
when multiple tags exist on one line. Replace the `.*` patterns with non-greedy
alternatives that specifically match only the path characters (such as `[^/]*`
for the version path portion) to ensure each replacement targets only the
intended version string rather than matching from the first occurrence to the
last occurrence on a line.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 56866470-0476-491c-a576-454246137048
📒 Files selected for processing (3)
src/features/devtools/components/VersionSwitcher/VersionSwitcher.tsxsrc/features/devtools/components/VersionSwitcher/versionSwitcherUtils.test.tssrc/features/devtools/components/VersionSwitcher/versionSwitcherUtils.ts
|
|
✅ Automatic backport successful! A backport PR has been automatically created for the The release branch The cherry-pick was clean with no conflicts. Please review the backport PR when it appears. |


If the html file loaded into the browser also contains a reference to the frontend in a comment, switching version from our internal dev tools would not work.
This is simply fixed by using replace all (/regexp/g) instead of just replace (/regexp/)
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit
Refactor
Tests