fix: use deriveLogicalProjectKeyFromSettings as fallback in syncProjects call sites

Both syncProjects call sites in service.ts were falling back to
derivePhysicalProjectKey(project) when the logical key map lookup missed,
while all other call sites across the codebase consistently fall back to
deriveLogicalProjectKeyFromSettings(project, settings). This latent
inconsistency could cause the UI store's logical key to diverge from
the logical key computed during thread creation and sidebar grouping,
potentially breaking project expansion state and thread routing.
This commit is contained in:
Cursor Agent committed 2026-04-27 18:34:06 +00:00
1 parent c421b5d054
commit 11e9d78da4
1 file changed
+7 -3
+7 -3
View File
@@ -61,7 +61,11 @@ import { useTerminalStateStore } from "~/terminalStateStore";
import { useUiStateStore } from "~/uiStateStore";
import { WsTransport } from "../../rpc/wsTransport";
import { createWsRpcClient, type WsRpcClient } from "../../rpc/wsRpcClient";
import { buildLogicalProjectKeyMap, derivePhysicalProjectKey } from "../../logicalProject";
import {
buildLogicalProjectKeyMap,
deriveLogicalProjectKeyFromSettings,
derivePhysicalProjectKey,
} from "../../logicalProject";
import { getClientSettings } from "~/hooks/useSettings";
type EnvironmentServiceState = {
@@ -476,7 +480,7 @@ function syncProjectUiFromStore() {
key: derivePhysicalProjectKey(project),
logicalKey:
logicalKeyByPhysicalKey.get(derivePhysicalProjectKey(project)) ??
derivePhysicalProjectKey(project),
deriveLogicalProjectKeyFromSettings(project, clientSettings),
cwd: project.cwd,
})),
);
@@ -554,7 +558,7 @@ function applyRecoveredEventBatch(
key: derivePhysicalProjectKey(project),
logicalKey:
logicalKeyByPhysicalKey.get(derivePhysicalProjectKey(project)) ??
derivePhysicalProjectKey(project),
deriveLogicalProjectKeyFromSettings(project, clientSettings),
cwd: project.cwd,
})),
);