Skip to content

Commit fcac5d4

Browse files
committed
self review
1 parent 52d24b3 commit fcac5d4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

extension/src/experiments/checkpoints/collect.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('collectHasCheckpoints', () => {
2828
expect(hasCheckpoints).toBe(true)
2929
})
3030

31-
it('should correctly identify a dvc.yaml without checkpoint', () => {
31+
it('should correctly classify a dvc.yaml without checkpoint', () => {
3232
const hasCheckpoints = collectHasCheckpoints({
3333
stages: {
3434
extract: {
@@ -51,7 +51,7 @@ describe('collectHasCheckpoints', () => {
5151
expect(hasCheckpoints).toBe(false)
5252
})
5353

54-
it('should correctly identify a more complex dvc.yaml without checkpoint', () => {
54+
it('should correctly classify a more complex dvc.yaml without checkpoint', () => {
5555
const hasCheckpoints = collectHasCheckpoints({
5656
stages: {
5757
evaluate: {

extension/src/experiments/checkpoints/model.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Deferred } from '@hediet/std/synchronization'
44
import { collectHasCheckpoints } from './collect'
55
import { findFiles } from '../../fileSystem/workspace'
66
import { isSameOrChild, loadYaml, PartialDvcYaml } from '../../fileSystem'
7-
import { definedAndNonEmpty } from '../../util/array'
7+
import { definedAndNonEmpty, uniqueValues } from '../../util/array'
88

99
export class ExperimentCheckpointsModel {
1010
public dispose = Disposable.fn()
@@ -35,8 +35,11 @@ export class ExperimentCheckpointsModel {
3535
if (yaml) {
3636
const hasCheckpoints = collectHasCheckpoints(yaml)
3737

38-
if (hasCheckpoints && !this.yamlWithCheckpoints.includes(path)) {
39-
this.yamlWithCheckpoints.push(path)
38+
if (hasCheckpoints) {
39+
this.yamlWithCheckpoints = uniqueValues([
40+
...this.yamlWithCheckpoints,
41+
path
42+
])
4043
} else {
4144
this.yamlWithCheckpoints = this.yamlWithCheckpoints.filter(
4245
file => file !== path

0 commit comments

Comments
 (0)