fix: don't reload external pages Closes #3299#3300
fix: don't reload external pages Closes #3299#3300gaincoder wants to merge 1 commit intoRocketChat:masterfrom
Conversation
WalkthroughThe injected script now includes a defensive check before force-reloading when Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 the current code and only fix it if needed.
Inline comments:
In `@src/injected.ts`:
- Line 57: Remove the trailing whitespace on the empty line inside the
injected.ts module: delete the spaces so the line is truly blank (or enable
trim-trailing-whitespace/save actions) to satisfy Prettier and linting; then
save/commit the change so CI passes.
🪄 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: 940bf340-450b-4a01-99ff-a2a304cd90d7
📒 Files selected for processing (1)
src/injected.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use TypeScript for all new code in this codebase unless explicitly told otherwise
Use Fuselage components from@rocket.chat/fuselagefor all UI work — only create custom components when Fuselage doesn't provide the needed functionality
Check Theme.d.ts for valid color tokens when working with Fuselage components
Use optional chaining with fallbacks for platform-specific APIs instead of mocks (e.g., process.getuid?.() ?? 1000) to ensure code works across all platforms without requiring mocks
TypeScript code must use strict mode
Use React functional components with hooks instead of class components
Redux actions must follow the FSA (Flux Standard Action) pattern
Use camelCase for file naming
Use PascalCase for component file names (React components)
Write self-documenting code through clear naming — avoid unnecessary comments
Files:
src/injected.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: Ram-sah19
Repo: RocketChat/Rocket.Chat.Electron PR: 3254
File: .github/workflows/build-release.yml:80-94
Timestamp: 2026-03-11T06:38:40.426Z
Learning: In the RocketChat/Rocket.Chat.Electron repository, the issues flagged in `.github/workflows/build-release.yml` (e.g., `node12` runtime in the release action and missing `snapcraft_token` input), i18n files, and `electron-builder.json` are pre-existing in the `develop` branch and are pulled in during merge conflict resolution. Do not flag these as new issues introduced by PRs that only modify `src/injected.ts` and `src/ui/main/rootWindow.ts`.
📚 Learning: 2026-03-11T06:38:40.426Z
Learnt from: Ram-sah19
Repo: RocketChat/Rocket.Chat.Electron PR: 3254
File: .github/workflows/build-release.yml:80-94
Timestamp: 2026-03-11T06:38:40.426Z
Learning: In the RocketChat/Rocket.Chat.Electron repository, the issues flagged in `.github/workflows/build-release.yml` (e.g., `node12` runtime in the release action and missing `snapcraft_token` input), i18n files, and `electron-builder.json` are pre-existing in the `develop` branch and are pulled in during merge conflict resolution. Do not flag these as new issues introduced by PRs that only modify `src/injected.ts` and `src/ui/main/rootWindow.ts`.
Applied to files:
src/injected.ts
🪛 ESLint
src/injected.ts
[error] 57-57: Delete ··········
(prettier/prettier)
🔇 Additional comments (1)
src/injected.ts (1)
51-56: Correctly skips force reload on external non-Meteor pages.This guard is a good fix for SAML/SSO external flows and prevents unwanted reload interruptions.
| ); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
Remove trailing whitespace to unblock Prettier.
Line 57 contains only spaces and is currently flagged by lint.
🧹 Minimal fix
-
+📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
🧰 Tools
🪛 ESLint
[error] 57-57: Delete ··········
(prettier/prettier)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/injected.ts` at line 57, Remove the trailing whitespace on the empty line
inside the injected.ts module: delete the spaces so the line is truly blank (or
enable trim-trailing-whitespace/save actions) to satisfy Prettier and linting;
then save/commit the change so CI passes.
On external pages (e.g. SAML/SSO), where window.require is not available, injected.ts fired a force-reload, this fix will avoid that
Summary by CodeRabbit