From 3ff7e66ecc4ad56c96f700c03a0bc2676f4ce75b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=86=E3=81=95=E3=81=BF=E3=82=87=E3=82=93/myon2019?= <56076195+mtripg6666tdr@users.noreply.github.com> Date: Mon, 8 Jul 2024 23:13:58 +0900 Subject: [PATCH] Fix: added index can be wrong (#2477) --- src/Component/queueManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Component/queueManager.ts b/src/Component/queueManager.ts index 88b395f6d..0a6da0d96 100644 --- a/src/Component/queueManager.ts +++ b/src/Component/queueManager.ts @@ -246,7 +246,7 @@ export class QueueManager extends ServerManagerBase { this.emit(method === "push" ? "changeWithoutCurrent" : "change"); this.emit("add", result); - const index = this._default.findIndex(q => q === result); + const index = method === "push" ? this._default.findLastIndex(q => q === result) : this._default.findIndex(q => q === result); this.logger.info(`queue content added at position ${index}`); return { ...result, index }; }