0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-19 23:31:11 +02:00

FIX: link index assignment edge cases

Dieser Commit ist enthalten in:
Angus McLeod 2022-10-19 18:07:19 +02:00
Ursprung 02255491d0
Commit 92b02ed7d9

Datei anzeigen

@ -76,9 +76,10 @@ export default Component.extend({
if (!items || items.length === 0) {
return 0;
}
const lastItem = items[items.length - 1];
const lastNumber = lastItem.id.split("_").pop();
return Number(lastNumber);
const numbers = items
.map((i) => Number(i.id.split("_").pop()))
.sort((a, b) => a - b);
return numbers[numbers.length - 1];
},
actions: {