From ddd51cac7d6dd7671beb3e7dc4fc964da09b2297 Mon Sep 17 00:00:00 2001 From: hanafish <1106510024@qq.com> Date: Tue, 11 Aug 2026 15:44:51 +0800 Subject: [PATCH] refactor(cloud): unify session scope resolution --- .../useCloudSessionShareDialog.ts | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/features/Org2Cloud/CloudSessionShareDialog/useCloudSessionShareDialog.ts b/src/features/Org2Cloud/CloudSessionShareDialog/useCloudSessionShareDialog.ts index d046904123..a8227ea873 100644 --- a/src/features/Org2Cloud/CloudSessionShareDialog/useCloudSessionShareDialog.ts +++ b/src/features/Org2Cloud/CloudSessionShareDialog/useCloudSessionShareDialog.ts @@ -9,11 +9,8 @@ import { useAtomValue, useStore } from "jotai"; import { useCallback, useMemo, useState, useSyncExternalStore } from "react"; -import { persistedScopeKeysForImportedSession } from "@src/features/TeamCollaboration/importedSessionScopeMatch"; import { getShareableScopeKeyVersion, - peekShareableScopeKeys, - primeShareableScopeKey, subscribeShareableScopeKeys, } from "@src/features/TeamCollaboration/repoScopeResolver"; import { sessionOrgTagsAtom } from "@src/features/TeamCollaboration/sessionOrgTagsAtom"; @@ -27,23 +24,9 @@ import { } from "../org2CloudOrgsAtom"; import { org2CloudRepoScopesAtom } from "../org2CloudSyncAtoms"; import { isCloudPushCandidate } from "../org2CloudSyncEngine"; +import { getSessionScopeKeys } from "../org2CloudSyncEngine.repoScopeSync"; import { getActiveCloudShareOrgsForSession } from "./shareEligibility"; -/** - * Resolved scope keys for one session, backed by the module-level resolver - * cache the sync engine also feeds (same idiom as useSessionShareDialog: - * `undefined` = still resolving → not eligible yet; the subscription - * re-renders the consumer when the keys land). - */ -function getSessionScopeKeys(session: Session): string[] | null | undefined { - const persistedKeys = persistedScopeKeysForImportedSession(session); - if (persistedKeys !== undefined) return persistedKeys; - if (!session.repoPath) return null; - const keys = peekShareableScopeKeys(session.repoPath); - if (keys === undefined) primeShareableScopeKey(session.repoPath); - return keys; -} - export interface UseCloudSessionShareDialogResult { /** Session the dialog is open for; null = closed. */ cloudShareSession: Session | null;