imdone-core 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/lib/repository.js +18 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 2.5.3
|
|
2
|
+
|
|
3
|
+
- Reorder configured lists atomically with `repository.moveList`, preserving every list field and unrelated configuration, rolling back failed saves, and emitting `list.modified` only after persistence succeeds.
|
|
4
|
+
|
|
1
5
|
## 2.3.5
|
|
2
6
|
|
|
3
7
|
- Incorporate newly added watched files into repository state before emitting `file.update`, so live board consumers can render the new task without a reload or restart.
|
package/lib/repository.js
CHANGED
|
@@ -1129,13 +1129,26 @@ export class Repository extends Emitter {
|
|
|
1129
1129
|
// order:-190
|
|
1130
1130
|
// -->
|
|
1131
1131
|
async moveList (name, pos) {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1132
|
+
const lists = this.getLists()
|
|
1133
|
+
const currentPosition = lists.findIndex((list) => list.name === name)
|
|
1134
|
+
if (currentPosition < 0) throw new Error(`List not found: ${name}`)
|
|
1135
|
+
if (!Number.isInteger(pos)) throw new TypeError('List position must be an integer')
|
|
1136
|
+
if (pos < 0 || pos >= lists.length) throw new RangeError(`List position out of range: ${pos}`)
|
|
1137
|
+
if (currentPosition === pos) return
|
|
1138
|
+
|
|
1139
|
+
const previousLists = lists.map((list) => ({ ...list }))
|
|
1140
|
+
const [list] = lists.splice(currentPosition, 1)
|
|
1141
|
+
lists.splice(pos, 0, list)
|
|
1142
|
+
this.config.lists = lists
|
|
1143
|
+
|
|
1144
|
+
try {
|
|
1136
1145
|
await this.saveConfig()
|
|
1137
|
-
|
|
1146
|
+
} catch (error) {
|
|
1147
|
+
this.config.lists = previousLists
|
|
1148
|
+
throw error
|
|
1138
1149
|
}
|
|
1150
|
+
|
|
1151
|
+
this.emit('list.modified', name)
|
|
1139
1152
|
}
|
|
1140
1153
|
|
|
1141
1154
|
// READY Refactor toggleListIgnore to use async/await
|