TypeScript
fix(web): let new threads choose each repository checkout (#15636)
maria838f43ff9fda
diff --git a/apps/web/src/components/CommandPalette.logic.test.ts b/apps/web/src/components/CommandPalette.logic.test.tsindex 101759fc6c4..4abd2a4655d 100644--- a/apps/web/src/components/CommandPalette.logic.test.ts+++ b/apps/web/src/components/CommandPalette.logic.test.ts@@ -348,6 +348,31 @@ function makeThread(overrides: Partial<Thread> = {}): Thread {}describe("buildProjectActionItems", () => {+ it("shows offline checkout rows but excludes them from keyboard selection", () => {+ const local = makeProject();+ const remote = makeProject({+ id: local.id,+ environmentId: EnvironmentId.make("offline"),+ });+ const items = buildProjectActionItems({+ projects: [remote, local].map((project) => ({ ...project, displayName: "shared-repo" })),+ valuePrefix: "new-thread-in",+ icon: () => null,+ runProject: async () => undefined,+ disabled: (project) => project.environmentId === remote.environmentId,+ });+ const groups = [{ value: "projects", label: "Projects", items }];+ const { rows, itemValues } = buildCommandPaletteRows(groups);++ expect(rows.filter((row) => row.kind === "item").map((row) => row.item.value)).toEqual([+ `new-thread-in:${remote.environmentId}:${remote.id}`,+ `new-thread-in:${local.environmentId}:${local.id}`,+ ]);+ expect(itemValues).toEqual([`new-thread-in:${local.environmentId}:${local.id}`]);+ expect(findHighlightedCommandPaletteItem(groups, items[0]!.value)).toBeNull();+ expect(findHighlightedCommandPaletteItem(groups, items[1]!.value)).toBe(items[1]);+ });+it("shows the grouped display name but keeps the real title for icons", () => {const project = makeProject({ title: "fleet", workspaceRoot: "/Users/theo/Code/p/fleet" });const iconTitles: string[] = [];diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.tsindex 3037ef72159..9da8c940be3 100644--- a/apps/web/src/components/CommandPalette.logic.ts+++ b/apps/web/src/components/CommandPalette.logic.ts@@ -315,6 +315,7 @@ export function buildProjectActionItems(input: {runProject: (project: CommandPaletteProject) => Promise<void>;searchTerms?: (project: CommandPaletteProject) => ReadonlyArray<string>;renderDescription?: (project: CommandPaletteProject) => ReactNode;+ disabled?: (project: CommandPaletteProject) => boolean;shortcutCommand?: KeybindingCommand;}): CommandPaletteActionItem[] {return input.projects.map((project) => ({@@ -329,6 +330,7 @@ export function buildProjectActionItems(input: {title: project.displayName,description: input.renderDescription?.(project) ?? project.workspaceRoot,icon: input.icon(project),+ ...(input.disabled ? { disabled: input.disabled(project) } : {}),...(input.shortcutCommand !== undefined ? { shortcutCommand: input.shortcutCommand } : {}),run: async () => {await input.runProject(project);diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsxindex 516ab3caa0b..db89bdb0812 100644--- a/apps/web/src/components/CommandPalette.tsx+++ b/apps/web/src/components/CommandPalette.tsx@@ -25,7 +25,7 @@ import {type AddProjectRemoteSourceReadiness,} from "@t3tools/client-runtime/operations/projects";import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";-import { connectionStatusText } from "@t3tools/client-runtime/connection";+import { connectionStatusText, connectionStatusTitle } from "@t3tools/client-runtime/connection";import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";import { resolveThreadReferenceCopyTarget } from "@t3tools/shared/threadReference";import {@@ -887,6 +887,20 @@ function OpenCommandPaletteDialog(props: {groups: projectGroups,preferredProjectRef: contextualProjectRef,});+ const isEnvironmentReachable = (environmentId: EnvironmentId) =>+ environments.some(+ (environment) =>+ environment.environmentId === environmentId && environment.connection.phase === "connected",+ );+ const threadPickerProjects = buildSidebarProjectPickerEntries({+ groups: projectGroups,+ preferredProjectRef: contextualProjectRef,+ expandCheckouts: true,+ isEnvironmentReachable,+ }).map(({ group, targetProject }) => ({+ ...targetProject,+ displayName: group.displayName,+ }));const pickerProjects = projectPickerEntries.map(({ group, targetProject }) => ({...targetProject,displayName: group.displayName,@@ -1163,18 +1177,16 @@ function OpenCommandPaletteDialog(props: {isScratchProject(project, scratchWorkspaceRootFor(project.environmentId));const projectItems = enumerateCommandPaletteItems(buildProjectActionItems({- projects: pickerProjects.filter((project) => !isScratch(project)),+ projects: threadPickerProjects.filter((project) => !isScratch(project)),valuePrefix: "new-thread-in",- searchTerms: (project) => {- const group = projectGroupByTargetKey.get(`${project.environmentId}:${project.id}`);- const location = projectEnvironmentLocationById.get(project.environmentId);- return [- ...(group?.memberProjects.flatMap((member) => [member.title, member.workspaceRoot]) ??- []),- ...(location ? [location.label] : []),- ];- },+ disabled: (project) => !isEnvironmentReachable(project.environmentId),+ searchTerms: (project) => [+ projectEnvironmentLocationById.get(project.environmentId)?.label ?? "Remote",+ ],renderDescription: (project) => {+ const environment = environments.find(+ (candidate) => candidate.environmentId === project.environmentId,+ );const location = projectEnvironmentLocationById.get(project.environmentId) ?? {kind: "remote",label: "Remote",@@ -1194,30 +1206,29 @@ function OpenCommandPaletteDialog(props: {</span><CommandPaletteMetaDot /><span className="truncate">{project.workspaceRoot}</span>+ {isEnvironmentReachable(project.environmentId) ? null : (+ <>+ <CommandPaletteMetaDot />+ <span className="shrink-0">+ {environment ? connectionStatusTitle(environment.connection) : "Unavailable"}+ </span>+ </>+ )}</span>);},icon: projectFaviconIcon,runProject: async (project) => {- const group = projectGroupByTargetKey.get(`${project.environmentId}:${project.id}`);- const contextualRefBelongsToGroup =- contextualProjectRef !== null &&- group?.memberProjectRefs.some(- (projectRef) =>- projectRef.environmentId === contextualProjectRef.environmentId &&- projectRef.projectId === contextualProjectRef.projectId,- );- await handleNewThread(- contextualRefBelongsToGroup- ? contextualProjectRef- : scopeProjectRef(project.environmentId, project.id),- );+ await handleNewThread(scopeProjectRef(project.environmentId, project.id), {+ environmentSelection: "manual",+ });},}),);if (scratchTargetEnvironmentId === null) return projectItems;- const noProjectIndex = pickerProjects[0] !== undefined && isScratch(pickerProjects[0]) ? 0 : 1;+ const noProjectIndex =+ threadPickerProjects[0] !== undefined && isScratch(threadPickerProjects[0]) ? 0 : 1;return [...projectItems.slice(0, noProjectIndex),{@@ -1620,7 +1631,7 @@ function OpenCommandPaletteDialog(props: {title: "New thread in...",icon: <SquarePenIcon className={ITEM_ICON_CLASS} />,addonIcon: <SquarePenIcon className={ADDON_ICON_CLASS} />,- groups: [{ value: "projects", label: "Projects", items: projectThreadItems }],+ groups: [{ value: "new-thread-in", label: "Projects", items: projectThreadItems }],});}@@ -1967,7 +1978,7 @@ function OpenCommandPaletteDialog(props: {case "new-thread-in":pushPaletteView({addonIcon: <SquarePenIcon className={ADDON_ICON_CLASS} />,- groups: [{ value: "projects", label: "Projects", items: projectThreadItems }],+ groups: [{ value: "new-thread-in", label: "Projects", items: projectThreadItems }],});return;case "change-theme":@@ -2114,7 +2125,9 @@ function OpenCommandPaletteDialog(props: {? changeThemeItem.groups: currentView?.groups[0]?.value === "appearance"? changeAppearanceItem.groups- : (currentView?.groups ?? rootGroups);+ : currentView?.groups[0]?.value === "new-thread-in"+ ? [{ value: "new-thread-in", label: "Projects", items: projectThreadItems }]+ : (currentView?.groups ?? rootGroups);const filteredGroups = filterCommandPaletteGroups({activeGroups,diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsxindex e87861cf93f..0c4b6f5a087 100644--- a/apps/web/src/components/Sidebar.tsx+++ b/apps/web/src/components/Sidebar.tsx@@ -130,6 +130,7 @@ import { readLocalApi } from "../localApi";import { useSidebarPendingFileDropStore } from "../sidebarPendingFileDropStore";import { selectProjectGroupingSettings } from "../logicalProject";import {+ countSidebarProjectChoices,projectGroupsSpanEnvironments,resolveSidebarProjectScopeKey,getSidebarProjectSettingsKey,@@ -4532,8 +4533,9 @@ export default function Sidebar() {updateThreadJumpHintsVisibility(shouldShowJumpHintsNow);}, [shouldShowJumpHintsNow, updateThreadJumpHintsVisibility]);+ const projectChoiceCount = countSidebarProjectChoices(projectGroups);const handleNewThreadClick = (event?: ReactMouseEvent) => {- if (shouldCreateNewThreadInCurrentProject(event?.shiftKey ?? false, projectGroups.length)) {+ if (shouldCreateNewThreadInCurrentProject(event?.shiftKey ?? false, projectChoiceCount)) {if (isMobile) setOpenMobile(false);void startNewThreadFromContext({activeDraftThread: newThreadContext.activeDraftThread,@@ -4549,7 +4551,7 @@ export default function Sidebar() {const newThreadShortcutLabel =shortcutLabelForCommand(keybindings, "chat.new") ??- (projectGroups.length <= 1 ? shortcutLabelForCommand(keybindings, "chat.newLocal") : undefined);+ (projectChoiceCount <= 1 ? shortcutLabelForCommand(keybindings, "chat.newLocal") : undefined);const newThreadInProjectShortcutLabel = shortcutLabelForCommand(keybindings, "chat.newLocal");return (<>@@ -4691,7 +4693,7 @@ export default function Sidebar() {newThreadDisabled={projects.length === 0}newThreadShortcutLabel={newThreadShortcutLabel}newThreadInProjectShortcutLabel={newThreadInProjectShortcutLabel}- showNewThreadInProjectHint={projectGroups.length > 1}+ showNewThreadInProjectHint={projectChoiceCount > 1}searchInputRef={threadSearchInputRef}searchQuery={threadSearchQuery}onSearchQueryChange={(value) => {diff --git a/apps/web/src/environmentGrouping.test.ts b/apps/web/src/environmentGrouping.test.tsindex 5be4dc5c261..eba9f1f9a9a 100644--- a/apps/web/src/environmentGrouping.test.ts+++ b/apps/web/src/environmentGrouping.test.ts@@ -12,6 +12,7 @@ import {buildPhysicalToLogicalProjectKeyMap,buildSidebarProjectPickerEntries,buildSidebarProjectSnapshots,+ countSidebarProjectChoices,projectGroupsSpanEnvironments,resolveSidebarProjectScopeKey,getSidebarProjectSettingsKey,@@ -77,6 +78,10 @@ describe("environment grouping", () => {const settingsGroups = buildSidebarProjectSnapshots(input);expect(filters).toHaveLength(1);expect(settingsGroups).toHaveLength(2);+ expect([+ countSidebarProjectChoices(filters),+ countSidebarProjectChoices(settingsGroups),+ ]).toEqual([1, 1]);expect(settingsGroups.map((group) => group.memberProjectRefs)).toEqual([[{ environmentId: local.environmentId, projectId: local.id }],[{ environmentId: remote.environmentId, projectId: remote.id }],@@ -565,6 +570,53 @@ describe("environment grouping", () => {});});+ it("offers every physical checkout, with reachable choices before an offline preference", () => {+ const primary = makeProject({ repositoryIdentity });+ const worktree = makeProject({+ id: ProjectId.make("local-worktree"),+ workspaceRoot: "/tmp/shared-repo-feature",+ repositoryIdentity,+ });+ const remote = makeProject({+ id: worktree.id,+ environmentId: remoteEnvironmentId,+ repositoryIdentity,+ });+ const groups = buildSidebarProjectSnapshots({+ projects: [remote, primary, worktree],+ settings: defaultGroupingSettings,+ primaryEnvironmentId,+ resolveEnvironmentLabel: () => null,+ });+ expect(countSidebarProjectChoices(groups)).toBe(3);+ const pickerInput = {+ groups,+ expandCheckouts: true,+ isEnvironmentReachable: (environmentId: EnvironmentId) =>+ environmentId === primaryEnvironmentId,+ };++ const connectedPreference = buildSidebarProjectPickerEntries({+ ...pickerInput,+ preferredProjectRef: { environmentId: primaryEnvironmentId, projectId: worktree.id },+ });+ expect(connectedPreference.map(({ targetProject }) => targetProject)).toMatchObject([+ worktree,+ primary,+ remote,+ ]);++ const offlinePreference = buildSidebarProjectPickerEntries({+ ...pickerInput,+ preferredProjectRef: { environmentId: remoteEnvironmentId, projectId: remote.id },+ });+ expect(offlinePreference.map(({ targetProject }) => targetProject)).toMatchObject([+ primary,+ worktree,+ remote,+ ]);+ });+it("keeps manual project order when building grouped sidebar entries", () => {const primary = makeProject({ repositoryIdentity });const remote = makeProject({diff --git a/apps/web/src/hooks/useHandleNewThread.test.ts b/apps/web/src/hooks/useHandleNewThread.test.tsindex 3fa77ce4b9c..b6057f3824d 100644--- a/apps/web/src/hooks/useHandleNewThread.test.ts+++ b/apps/web/src/hooks/useHandleNewThread.test.ts@@ -103,12 +103,14 @@ vi.mock("@effect/atom-react", () => ({? { newWorktreesStartFromOrigin: !testState.targetSettings.newWorktreesStartFromOrigin }: testServerConfigs(),}));-vi.mock("@t3tools/client-runtime/environment", () => ({+vi.mock("@t3tools/client-runtime/environment", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@t3tools/client-runtime/environment")>()),scopedProjectKey: () => "remote-project",scopeProjectRef: (environmentId: string, projectId: string) => ({ environmentId, projectId }),scopeThreadRef: (environmentId: string, threadId: string) => ({ environmentId, threadId }),}));-vi.mock("@t3tools/contracts", () => ({+vi.mock("@t3tools/contracts", async (importOriginal) => ({+ ...(await importOriginal<typeof import("@t3tools/contracts")>()),DEFAULT_RUNTIME_MODE: "default",DEFAULT_SERVER_SETTINGS: {},}));@@ -138,7 +140,8 @@ vi.mock("@tanstack/react-router", () => ({useParams: () => null,useRouter: () => testState.router,}));-vi.mock("react", () => ({+vi.mock("react", async (importOriginal) => ({+ ...(await importOriginal<typeof import("react")>()),useCallback: <T>(callback: T) => callback,useMemo: <T>(factory: () => T) => factory(),}));@@ -199,6 +202,49 @@ vi.mock("../uiStateStore", () => ({vi.mock("./useSettings", () => ({ useClientSettings: () => ({}) }));import { useNewThreadHandler } from "./useHandleNewThread";+import { useComposerDraftStore } from "../composerDraftStore";++it("pins a reused automatic draft to the explicitly selected checkout", async () => {+ const { useComposerDraftStore: realDraftStore, DraftId } =+ await vi.importActual<typeof import("../composerDraftStore")>("../composerDraftStore");+ const { EnvironmentId, ProjectId, ThreadId } =+ await vi.importActual<typeof import("@t3tools/contracts")>("@t3tools/contracts");+ testState.reset(null);+ const draftId = DraftId.make("draft-manual-checkout");+ const projectRef = {+ environmentId: EnvironmentId.make("environment-ssh"),+ projectId: ProjectId.make("project-remote"),+ };+ const store = realDraftStore.getState();+ store.setLogicalProjectDraftThreadId(+ "remote-project",+ {+ environmentId: EnvironmentId.make("environment-primary"),+ projectId: ProjectId.make("local"),+ },+ draftId,+ {+ threadId: ThreadId.make("thread-manual-checkout"),+ environmentSelection: "auto",+ loadBalancedEnvironmentId: EnvironmentId.make("environment-primary"),+ },+ );+ const getState = vi.spyOn(useComposerDraftStore, "getState").mockReturnValue(store);+ try {+ const opened = await useNewThreadHandler()(projectRef, { environmentSelection: "manual" });++ expect(opened?.draftId).toBe(draftId);+ expect(store.getDraftSession(draftId)).toMatchObject({+ environmentId: projectRef.environmentId,+ projectId: projectRef.projectId,+ environmentSelection: "manual",+ loadBalancedEnvironmentId: null,+ });+ } finally {+ getState.mockRestore();+ realDraftStore.setState(store, true);+ }+});describe.each([["new", null],diff --git a/apps/web/src/hooks/useHandleNewThread.ts b/apps/web/src/hooks/useHandleNewThread.tsindex cfb98fc83bd..b6143e45324 100644--- a/apps/web/src/hooks/useHandleNewThread.ts+++ b/apps/web/src/hooks/useHandleNewThread.ts@@ -74,6 +74,7 @@ export function useNewThreadHandler() {envMode?: DraftThreadEnvMode;startFromOrigin?: boolean;replace?: boolean;+ environmentSelection?: "manual";},): Promise<{ draftId: DraftId; threadId: ThreadId } | null> => {const projects = readProjects();@@ -167,6 +168,10 @@ export function useNewThreadHandler() {const hasWorktreePathOption = options?.worktreePath !== undefined;const hasEnvModeOption = options?.envMode !== undefined;const hasStartFromOriginOption = options?.startFromOrigin !== undefined;+ const selectionOptions =+ options?.environmentSelection === "manual"+ ? { environmentSelection: "manual" as const, loadBalancedEnvironmentId: null }+ : {};const storedDraftThread = getDraftSessionByLogicalProjectKey(logicalProjectKey);const storedDraftThreadRef = storedDraftThread? scopeThreadRef(storedDraftThread.environmentId, storedDraftThread.threadId)@@ -267,6 +272,7 @@ export function useNewThreadHandler() {projectRef,emptyStoredDraftThread.draftId,{+ ...selectionOptions,threadId: emptyStoredDraftThread.threadId,...workspaceContext,...(!isDraftAlreadyOpen ? { runtimeMode: defaultRuntimeMode } : {}),@@ -309,6 +315,7 @@ export function useNewThreadHandler() {setDraftThreadContext(currentRouteTarget.draftId, pickExplicitWorkspaceOptions(options));}setLogicalProjectDraftThreadId(logicalProjectKey, projectRef, currentRouteTarget.draftId, {+ ...selectionOptions,threadId: latestActiveDraftThread.threadId,createdAt: latestActiveDraftThread.createdAt,runtimeMode: latestActiveDraftThread.runtimeMode,@@ -340,6 +347,7 @@ export function useNewThreadHandler() {readThreadShell(scopeThreadRef(racedDraft.environmentId, racedDraft.threadId)) === null) {setLogicalProjectDraftThreadId(logicalProjectKey, projectRef, racedDraft.draftId, {+ ...selectionOptions,threadId: racedDraft.threadId,createdAt: racedDraft.createdAt,runtimeMode: racedDraft.runtimeMode,@@ -354,6 +362,7 @@ export function useNewThreadHandler() {return { draftId: racedDraft.draftId, threadId: racedDraft.threadId };}setLogicalProjectDraftThreadId(logicalProjectKey, projectRef, draftId, {+ ...selectionOptions,threadId,createdAt,branch: options?.branch ?? null,diff --git a/apps/web/src/routes/_chat.tsx b/apps/web/src/routes/_chat.tsxindex 53c11954cec..de21ef7a1e1 100644--- a/apps/web/src/routes/_chat.tsx+++ b/apps/web/src/routes/_chat.tsx@@ -13,7 +13,10 @@ import { isPreviewAvailableFor } from "../browser/previewRuntime";import { usePrimaryEnvironmentId } from "../state/environments";import { useEnvironmentScope } from "../state/session";import { selectProjectGroupingSettings } from "../logicalProject";-import { buildSidebarProjectSnapshots } from "../sidebarProjectGrouping";+import {+ buildSidebarProjectSnapshots,+ countSidebarProjectChoices,+} from "../sidebarProjectGrouping";import { dispatchPreviewAction } from "../components/preview/previewActionBus";import { useHandleNewThread } from "../hooks/useHandleNewThread";import { useScratchProject } from "../hooks/useScratchProject";@@ -46,12 +49,14 @@ function ChatRouteGlobalShortcuts() {const projects = useProjects();const primaryEnvironmentId = usePrimaryEnvironmentId();const { scratchEnvironmentId, startScratchThread } = useScratchProject();- const projectGroupCount = buildSidebarProjectSnapshots({- projects,- settings: projectGroupingSettings,- primaryEnvironmentId,- resolveEnvironmentLabel: () => null,- }).length;+ const projectChoiceCount = countSidebarProjectChoices(+ buildSidebarProjectSnapshots({+ projects,+ settings: projectGroupingSettings,+ primaryEnvironmentId,+ resolveEnvironmentLabel: () => null,+ }),+ );const terminalOpen = useTerminalUiStateStore((state) =>routeThreadRef? selectThreadTerminalUiState(state.terminalUiStateByThreadKey, routeThreadRef).terminalOpen@@ -124,7 +129,7 @@ function ChatRouteGlobalShortcuts() {if (command === "chat.new") {event.preventDefault();event.stopPropagation();- if (!legacySidebarEnabled && projectGroupCount > 1) {+ if (!legacySidebarEnabled && projectChoiceCount > 1) {openCommandPalette({ open: "new-thread-in" });return;}@@ -193,7 +198,7 @@ function ChatRouteGlobalShortcuts() {defaultProjectRef,previewOpen,primaryEnvironmentId,- projectGroupCount,+ projectChoiceCount,routeThreadRef,scratchEnvironmentId,selectedThreadKeysSize,diff --git a/apps/web/src/sidebarProjectGrouping.ts b/apps/web/src/sidebarProjectGrouping.tsindex 7182405bbd0..230c2fa16a4 100644--- a/apps/web/src/sidebarProjectGrouping.ts+++ b/apps/web/src/sidebarProjectGrouping.ts@@ -26,6 +26,18 @@ export interface SidebarProjectSnapshot extends Project {remoteEnvironmentLabels: readonly string[];}+export function countSidebarProjectChoices(groups: ReadonlyArray<SidebarProjectSnapshot>): number {+ let checkoutCount = 0;+ let hasScratch = false;+ for (const group of groups) {+ for (const project of group.memberProjects) {+ if (project.isScratch) hasScratch = true;+ else checkoutCount += 1;+ }+ }+ return checkoutCount + Number(hasScratch);+}+export function projectGroupsSpanEnvironments(groups: ReadonlyArray<Pick<SidebarProjectSnapshot, "memberProjects">>,): boolean {@@ -173,8 +185,33 @@ export function buildSidebarProjectSnapshots(input: {export function buildSidebarProjectPickerEntries(input: {groups: ReadonlyArray<SidebarProjectSnapshot>;preferredProjectRef: ScopedProjectRef | null;+ expandCheckouts?: boolean;+ isEnvironmentReachable?: (environmentId: EnvironmentId) => boolean;}) {const preferredProjectRef = input.preferredProjectRef;+ if (input.expandCheckouts) {+ // memberProjects already deduplicates physical checkouts. Keep distinct+ // worktrees on the same environment as separate choices.+ return input.groups+ .flatMap((group) =>+ group.memberProjects.map((targetProject): SidebarProjectPickerEntry => ({+ group,+ targetProject,+ isPreferred:+ preferredProjectRef !== null &&+ targetProject.environmentId === preferredProjectRef.environmentId &&+ targetProject.id === preferredProjectRef.projectId,+ })),+ )+ .toSorted((left, right) => {+ const reachability = input.isEnvironmentReachable;+ const reachableDelta = reachability+ ? Number(reachability(right.targetProject.environmentId)) -+ Number(reachability(left.targetProject.environmentId))+ : 0;+ return reachableDelta || Number(right.isPreferred) - Number(left.isPreferred);+ });+ }const entries = input.groups.flatMap((group): SidebarProjectPickerEntry[] => {const isPreferred = preferredProjectRef? group.memberProjectRefs.some(