Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 2adaad6

Browse files
committed
fix bug when removing cards
skipping cards when iterating index while also shortening array
1 parent ba77ea6 commit 2adaad6

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,8 +2270,8 @@ function run() {
22702270
yield ensureCard(automationNoteCard, 0, targetColumn);
22712271
// delete all cards in target column that do not exist in the source column,
22722272
// except for the automation note
2273-
// start at index 1 to account for the automation note card
2274-
for (let index = 1; index < targetColumn.cards.nodes.length; index++) {
2273+
// don't iterate over index 0, to account for the automation note card
2274+
for (let index = targetColumn.cards.nodes.length - 1; index >= 1; index--) {
22752275
const targetCard = targetColumn.cards.nodes[index];
22762276
const [sourceCard] = findCard(targetCard, sourceColumn);
22772277
if (!sourceCard) {

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ async function run(): Promise<void> {
125125

126126
// delete all cards in target column that do not exist in the source column,
127127
// except for the automation note
128-
// start at index 1 to account for the automation note card
129-
for (let index = 1; index < targetColumn.cards.nodes.length; index++) {
128+
// don't iterate over index 0, to account for the automation note card
129+
for (let index = targetColumn.cards.nodes.length - 1; index >= 1; index--) {
130130
const targetCard = targetColumn.cards.nodes[index]
131131
const [sourceCard] = findCard(targetCard, sourceColumn)
132132

0 commit comments

Comments
 (0)