chg: show localhost port # in tab title#2566
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughA compile-time Changes
🚥 Pre-merge checks | ✅ 1 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (1 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 `@js/app/packages/core/signal/tabTitle.ts`:
- Around line 9-10: The prefix logic currently truncates the port to the last
digit and hides port 3000; update the conditional that builds the title prefix
(the code referencing port and port.slice(-1)) to include the full port string
instead of slicing and do not special-case '3000'—return `[L:${port}] ` when
port is truthy and not empty, otherwise fall back to `[L] ` so the full
localhost port is shown in the title.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 93828729-d152-4230-91b1-bb11c674d912
📒 Files selected for processing (1)
js/app/packages/core/signal/tabTitle.ts
| if (port && port !== '3000') return `[L:${port.slice(-1)}] `; | ||
| return '[L] '; |
There was a problem hiding this comment.
Show the full localhost port in the prefix.
Line 9 currently truncates to the last digit (port.slice(-1)) and Line 9/10 hides 3000, so the title can’t reliably identify which local instance is open. This misses the PR goal of showing the localhost port number.
Proposed fix
function getEnvPrefix(): string {
if (LOCAL_ONLY) {
const port = window.location.port;
- if (port && port !== '3000') return `[L:${port.slice(-1)}] `;
+ if (port) return `[L:${port}] `;
return '[L] ';
}
return DEV_MODE_ENV ? '[D] ' : '';
}📝 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.
| if (port && port !== '3000') return `[L:${port.slice(-1)}] `; | |
| return '[L] '; | |
| function getEnvPrefix(): string { | |
| if (LOCAL_ONLY) { | |
| const port = window.location.port; | |
| if (port) return `[L:${port}] `; | |
| return '[L] '; | |
| } | |
| return DEV_MODE_ENV ? '[D] ' : ''; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@js/app/packages/core/signal/tabTitle.ts` around lines 9 - 10, The prefix
logic currently truncates the port to the last digit and hides port 3000; update
the conditional that builds the title prefix (the code referencing port and
port.slice(-1)) to include the full port string instead of slicing and do not
special-case '3000'—return `[L:${port}] ` when port is truthy and not empty,
otherwise fall back to `[L] ` so the full localhost port is shown in the title.
No description provided.