Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down
Loading