From de426397262f6b28d88f2f72a3941cfd52942b94 Mon Sep 17 00:00:00 2001
From: TrainDoctor <traindoctor@protonmail.com>
Date: Sun, 13 Nov 2022 16:01:06 -0800
Subject: Add errored plugins to plugin array for uninstalls

---
 frontend/src/plugin-loader.tsx | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

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

diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx
index f24a9605..47747f75 100644
--- a/frontend/src/plugin-loader.tsx
+++ b/frontend/src/plugin-loader.tsx
@@ -8,7 +8,7 @@ import {
   sleep,
   staticClasses,
 } from 'decky-frontend-lib';
-import { lazy } from 'react';
+import { FC, lazy } from 'react';
 import { FaExclamationCircle, FaPlug } from 'react-icons/fa';
 
 import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState';
@@ -245,6 +245,20 @@ class PluginLoader extends Logger {
         });
       } catch (e) {
         this.error('Error loading plugin ' + name, e);
+        const TheError: FC<{}> = () => (
+          <>
+            Error:{' '}
+            <pre>
+              <code>{e}</code>
+            </pre>
+          </>
+        );
+        this.plugins.push({
+          name: name,
+          version: version,
+          content: <TheError />,
+          icon: <FaExclamationCircle />,
+        });
         this.toaster.toast({ title: 'Error loading ' + name, body: '' + e, icon: <FaExclamationCircle /> });
       }
     } else throw new Error(`${name} frontend_bundle not OK`);
-- 
cgit v1.2.3

