From 3e250dd18044885a9864a41e710fce772eeb918b Mon Sep 17 00:00:00 2001
From: Jonas Dellinger <jonas@dellinger.dev>
Date: Mon, 20 Jun 2022 15:54:31 +0200
Subject: Fix importPlugin queue

---
 frontend/src/plugin-loader.tsx | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'frontend/src/plugin-loader.tsx')

diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx
index b8729168..442db3e4 100644
--- a/frontend/src/plugin-loader.tsx
+++ b/frontend/src/plugin-loader.tsx
@@ -79,13 +79,14 @@ class PluginLoader extends Logger {
   }
 
   public async importPlugin(name: string) {
-    try {
-      if (this.reloadLock) {
-        this.log('Reload currently in progress, adding to queue', name);
-        this.pluginReloadQueue.push(name);
-        return;
-      }
+    if (this.reloadLock) {
+      this.log('Reload currently in progress, adding to queue', name);
+      this.pluginReloadQueue.push(name);
+      return;
+    }
 
+    try {
+      this.reloadLock = true;
       this.log(`Trying to load ${name}`);
 
       const oldPlugin = this.plugins.find((plugin) => plugin.name === name);
-- 
cgit v1.2.3

