Skip to content

Commit

Permalink
serverAPIState: remove latestCommitTree states
Browse files Browse the repository at this point in the history
Summary: Those (without preview) states are replaced by latestDag.

Reviewed By: evangrayk

Differential Revision: D51813805

fbshipit-source-id: 8ddcbbb8638402284bccbcaddbbc1e39544976ae
  • Loading branch information
quark-zju authored and facebook-github-bot committed Dec 4, 2023
1 parent 1d07547 commit dff308f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
10 changes: 1 addition & 9 deletions addons/isl/src/getCommitTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type {CommitPreview, Dag, WithPreviewType} from './previews';
import type {CommitInfo, Hash} from './types';
import type {CommitInfo} from './types';

export type CommitTree = {
info: CommitInfo;
Expand Down Expand Up @@ -130,11 +130,3 @@ export function findCurrentPublicBase(dag?: Dag): CommitInfo | undefined {
}
return undefined;
}

export function makeTreeMap(trees: Array<CommitTree>): Map<Hash, CommitTree> {
const map = new Map();
for (const tree of walkTreePostorder(trees)) {
map.set(tree.info.hash, tree);
}
return map;
}
31 changes: 0 additions & 31 deletions addons/isl/src/serverAPIState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import type {MessageBusStatus} from './MessageBus';
import type {CommitTree} from './getCommitTree';
import type {Operation} from './operations/Operation';
import type {
ApplicationInfo,
Expand All @@ -28,7 +27,6 @@ import serverAPI from './ClientToServerAPI';
import messageBus from './MessageBus';
import {latestSuccessorsMap, successionTracker} from './SuccessionTracker';
import {Dag} from './dag/dag';
import {makeTreeMap, getCommitTree} from './getCommitTree';
import {persistAtomToConfigEffect} from './persistAtomToConfigEffect';
import {clearOnCwdChange} from './recoilUtils';
import {initialParams} from './urlParams';
Expand Down Expand Up @@ -385,20 +383,6 @@ export const commitsShownRange = atom<number | undefined>({
],
});

/**
* Latest fetched commit tree from the server, without any previews.
* Prefer using `treeWithPreviews.trees`, since it includes optimistic state
* and previews.
*/
export const latestCommitTree = selector<Array<CommitTree>>({
key: 'latestCommitTree',
get: ({get}) => {
const commits = get(latestCommits);
const tree = getCommitTree(commits);
return tree;
},
});

/**
* Latest head commit from original data from the server, without any previews.
* Prefer using `treeWithPreviews.headCommit`, since it includes optimistic state
Expand All @@ -412,21 +396,6 @@ export const latestHeadCommit = selector<CommitInfo | undefined>({
},
});

/**
* Mapping of commit hash -> subtree at that commit
* Latest mapping of commit hash -> subtree at that commit from original data
* from the server, without any previews.
* Prefer using `treeWithPreviews.treeMap`, since it includes
* optimistic state and previews.
*/
export const latestCommitTreeMap = selector<Map<Hash, CommitTree>>({
key: 'latestCommitTreeMap',
get: ({get}) => {
const trees = get(latestCommitTree);
return makeTreeMap(trees);
},
});

/**
* No longer in the "loading" state:
* - Either the list of commits has successfully loaded
Expand Down

0 comments on commit dff308f

Please sign in to comment.