Skip to content

Commit bb566fd

Browse files
committed
refactor(project): Fix stage writer order
1 parent 02ece3b commit bb566fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/project/lib/specifications/Project.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ class Project extends Specification {
462462

463463
class Stage {
464464
#id;
465-
#writerVersions = [];
465+
#writerVersions = []; // First element is the latest writer
466466
#cacheReader;
467467

468468
constructor(id, cacheReader) {
@@ -475,16 +475,16 @@ class Stage {
475475
}
476476

477477
newVersion(writer) {
478-
this.#writerVersions.push(writer);
478+
this.#writerVersions.unshift(writer);
479479
}
480480

481481
getWriter() {
482-
return this.#writerVersions[this.#writerVersions.length - 1];
482+
return this.#writerVersions[0];
483483
}
484484

485485
getAllWriters(includeCache = true) {
486486
if (includeCache && this.#cacheReader) {
487-
return [this.#cacheReader, ...this.#writerVersions];
487+
return [...this.#writerVersions, this.#cacheReader];
488488
}
489489
return this.#writerVersions;
490490
}

0 commit comments

Comments
 (0)