diff --git a/extension/src/cli/dvc/constants.ts b/extension/src/cli/dvc/constants.ts index bb48c418d9..bb57330fc7 100644 --- a/extension/src/cli/dvc/constants.ts +++ b/extension/src/cli/dvc/constants.ts @@ -15,7 +15,8 @@ export const DVCLIVE_ONLY_RUNNING_SIGNAL_FILE = join( ) export const EXP_RWLOCK_FILE = join(TEMP_EXP_DIR, 'rwlock.lock') -export const DEFAULT_NUM_OF_COMMITS_TO_SHOW = 3 +export const DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW = 3 +export const DEFAULT_OTHER_BRANCH_COMMITS_TO_SHOW = 1 export const NUM_OF_COMMITS_TO_INCREASE = 2 export enum Command { diff --git a/extension/src/experiments/model/index.ts b/extension/src/experiments/model/index.ts index c5a6b913d3..700e390f0e 100644 --- a/extension/src/experiments/model/index.ts +++ b/extension/src/experiments/model/index.ts @@ -35,7 +35,10 @@ import { flattenMapValues } from '../../util/map' import { ModelWithPersistence } from '../../persistence/model' import { PersistenceKey } from '../../persistence/constants' import { sum } from '../../util/math' -import { DEFAULT_NUM_OF_COMMITS_TO_SHOW } from '../../cli/dvc/constants' +import { + DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW, + DEFAULT_OTHER_BRANCH_COMMITS_TO_SHOW +} from '../../cli/dvc/constants' type StarredExperiments = Record @@ -456,7 +459,12 @@ export class ExperimentsModel extends ModelWithPersistence { } public getNbOfCommitsToShow(branch: string) { - return this.numberOfCommitsToShow[branch] || DEFAULT_NUM_OF_COMMITS_TO_SHOW + return ( + this.numberOfCommitsToShow[branch] || + (branch === this.currentBranch + ? DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW + : DEFAULT_OTHER_BRANCH_COMMITS_TO_SHOW) + ) } public getAllNbOfCommitsToShow() { diff --git a/extension/src/test/suite/experiments/data/index.test.ts b/extension/src/test/suite/experiments/data/index.test.ts index 83f9fe978a..3dc17df2a0 100644 --- a/extension/src/test/suite/experiments/data/index.test.ts +++ b/extension/src/test/suite/experiments/data/index.test.ts @@ -20,7 +20,7 @@ import { } from '../../../../commands/internal' import { buildExperimentsData } from '../util' import { - DEFAULT_NUM_OF_COMMITS_TO_SHOW, + DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW, ExperimentFlag } from '../../../../cli/dvc/constants' import { EXPERIMENTS_GIT_LOGS_REFS } from '../../../../experiments/data/constants' @@ -103,7 +103,7 @@ suite('Experiments Data Test Suite', () => { { getBranchesToShow: () => ['main'], getNbOfCommitsToShow: () => ({ - main: DEFAULT_NUM_OF_COMMITS_TO_SHOW + main: DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW }), setBranches: stub() } as unknown as ExperimentsModel, @@ -165,7 +165,7 @@ suite('Experiments Data Test Suite', () => { { getBranchesToShow: () => ['main'], getNbOfCommitsToShow: () => ({ - main: DEFAULT_NUM_OF_COMMITS_TO_SHOW + main: DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW }), setBranches: stub() } as unknown as ExperimentsModel, diff --git a/extension/src/test/suite/experiments/util.ts b/extension/src/test/suite/experiments/util.ts index eb86e20d61..9f02feee6b 100644 --- a/extension/src/test/suite/experiments/util.ts +++ b/extension/src/test/suite/experiments/util.ts @@ -16,7 +16,7 @@ import { ExperimentsData } from '../../../experiments/data' import * as Watcher from '../../../fileSystem/watcher' import { ExperimentsModel } from '../../../experiments/model' import { ColumnsModel } from '../../../experiments/columns/model' -import { DEFAULT_NUM_OF_COMMITS_TO_SHOW } from '../../../cli/dvc/constants' +import { DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW } from '../../../cli/dvc/constants' import { PersistenceKey } from '../../../persistence/constants' import { ExpShowOutput } from '../../../cli/dvc/contract' import { buildExperimentsPipeline } from '../pipeline/util' @@ -235,7 +235,7 @@ export const buildExperimentsData = ( internalCommands, { getBranchesToShow: mockGetBranchesToShow, - getNbOfCommitsToShow: () => DEFAULT_NUM_OF_COMMITS_TO_SHOW, + getNbOfCommitsToShow: () => DEFAULT_CURRENT_BRANCH_COMMITS_TO_SHOW, setBranches: mockSetBranches } as unknown as ExperimentsModel, []