From 0b6ba868ce58741531b1db938f56c7225a141de5 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Mon, 4 Apr 2022 12:15:13 +0200 Subject: [PATCH] FIX: Ensure we always progress index --- .../discourse/components/wizard-links.js.es6 | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/assets/javascripts/discourse/components/wizard-links.js.es6 b/assets/javascripts/discourse/components/wizard-links.js.es6 index 62c45911..bf0dd242 100644 --- a/assets/javascripts/discourse/components/wizard-links.js.es6 +++ b/assets/javascripts/discourse/components/wizard-links.js.es6 @@ -78,16 +78,9 @@ export default Component.extend({ let params = setWizardDefaults({}, itemType); params.isNew = true; + params.index = items.length; - let index = 0; - if (items.length) { - let last_item = items[items.length - 1]; - index = Number(last_item.id.split("_").pop()); - } - - params.index = index; - - let id = `${itemType}_${index + 1}`; + let id = `${itemType}_${params.index + 1}`; if (itemType === "field") { id = `${this.parentId}_${id}`; }