Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions apps/desktop/src/window/DesktopWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,6 @@ export const make = Effect.gen(function* () {
}
});

window.on("page-title-updated", (event) => {
event.preventDefault();
window.setTitle(environment.displayName);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Load handler resets window title

Medium Severity

Removing the page-title-updated lock lets the renderer drive the native title, but did-finish-load still calls setTitle with environment.displayName. That main-process write can run after DocumentTitleSync has already set a thread/project document.title. Because the React effect does not re-run, the native title can stay on the generic app name—so desktop time trackers still cannot distinguish sessions after open or reload.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4fc7a33. Configure here.

window.on("resize", scheduleBoundsPersist);
window.on("move", scheduleBoundsPersist);
window.on("maximize", scheduleBoundsPersist);
Expand Down
12 changes: 10 additions & 2 deletions apps/web/src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
type ErrorComponentProps,
useLocation,
useNavigate,
useParams,
} from "@tanstack/react-router";
import { useEffect, useEffectEvent, useRef, useState } from "react";

Expand Down Expand Up @@ -50,7 +51,8 @@ import {
primaryServerConfigEventAtom,
primaryServerWelcomeAtom,
} from "../state/server";
import { readProject, setActiveEnvironmentId, useActiveEnvironmentId } from "../state/entities";
import { readProject, setActiveEnvironmentId, useActiveEnvironmentId, useProject, useThreadShell } from "../state/entities";
import { resolveThreadRouteRef } from "../threadRoutes";
import {
createKeybindingsUpdateToastController,
type KeybindingsUpdateToastController,
Expand Down Expand Up @@ -193,14 +195,20 @@ function FontAppearanceSync() {
}

function DocumentTitleSync() {
const threadRef = useParams({ strict: false, select: resolveThreadRouteRef });
const thread = useThreadShell(threadRef);
const project = useProject(
thread ? scopeProjectRef(thread.environmentId, thread.projectId) : null,
);
const primaryServerVersion =
useAtomValue(primaryServerConfigAtom)?.environment.serverVersion ?? null;
const title = resolveServerBackedAppDisplayName({
const appTitle = resolveServerBackedAppDisplayName({
baseName: APP_BASE_NAME,
fallbackDisplayName: APP_DISPLAY_NAME,
fallbackStageLabel: APP_STAGE_LABEL,
primaryServerVersion,
});
const title = thread && project ? `${thread.title} — ${project.title}` : appTitle;

useEffect(() => {
document.title = title;
Expand Down
Loading