From e1e917ab1084e7aa38f996e931eddede00efeb5e Mon Sep 17 00:00:00 2001 From: Willy-J <32266792+Willy-J@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:08:28 +0800 Subject: [PATCH] Fix: error when delete workflow --- src/stores/workflow.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/stores/workflow.js b/src/stores/workflow.js index 245350b1..b7b06a1a 100644 --- a/src/stores/workflow.js +++ b/src/stores/workflow.js @@ -282,8 +282,9 @@ export const useWorkflowStore = defineStore('workflow', { const { pinnedWorkflows } = await browser.storage.local.get( 'pinnedWorkflows' ); - const pinnedWorkflowIndex = - pinnedWorkflows && pinnedWorkflows.indexOf(id); + const pinnedWorkflowIndex = pinnedWorkflows + ? pinnedWorkflows.indexOf(id) + : -1; if (pinnedWorkflowIndex !== -1) { pinnedWorkflows.splice(pinnedWorkflowIndex, 1); await browser.storage.local.set({ pinnedWorkflows });