summaryrefslogtreecommitdiff
path: root/frontend/src/plugin-loader.tsx
diff options
context:
space:
mode:
authorAAGaming <aa@mail.catvibers.me>2022-10-24 19:14:56 -0400
committerGitHub <noreply@github.com>2022-10-24 16:14:56 -0700
commit84c3b039c385ad872bb0f22eba7a3d2cd4a5ea10 (patch)
tree20b13066c6256cc6ca1beac085094c7964226a37 /frontend/src/plugin-loader.tsx
parent2e6b3834da357c7e81821ce60bad36f54dd9fa6e (diff)
downloaddecky-loader-84c3b039c385ad872bb0f22eba7a3d2cd4a5ea10.tar.gz
decky-loader-84c3b039c385ad872bb0f22eba7a3d2cd4a5ea10.zip
preview 10/21/2022 fixes (#234)
* initial fixes: everything working except toasts and patch notes * tabshook changes, disable toaster for now * prettier * oops * implement custom toaster because I am tired of Valve's shit also fix QAM not injecting sometimes * remove extra logging * add findSP, fix patch notes, fix vscode screwup * fix patch notes * show error when plugin frontends fail to load * add get_tab_lambda * add css and has_element helpers to Tab * small modals fixup * Don't forceUpdate QuickAccess on stable * add routes prop used to get tabs component * add more dev utils to DFL global
Diffstat (limited to 'frontend/src/plugin-loader.tsx')
-rw-r--r--frontend/src/plugin-loader.tsx23
1 files changed, 14 insertions, 9 deletions
diff --git a/frontend/src/plugin-loader.tsx b/frontend/src/plugin-loader.tsx
index 400e7484..92c634c9 100644
--- a/frontend/src/plugin-loader.tsx
+++ b/frontend/src/plugin-loader.tsx
@@ -9,7 +9,7 @@ import {
staticClasses,
} from 'decky-frontend-lib';
import { lazy } from 'react';
-import { FaPlug } from 'react-icons/fa';
+import { FaExclamationCircle, FaPlug } from 'react-icons/fa';
import { DeckyState, DeckyStateContextProvider, useDeckyState } from './components/DeckyState';
import LegacyPlugin from './components/LegacyPlugin';
@@ -41,7 +41,7 @@ class PluginLoader extends Logger {
private tabsHook: TabsHook = new TabsHook();
// private windowHook: WindowHook = new WindowHook();
private routerHook: RouterHook = new RouterHook();
- public toaster: Toaster = new Toaster();
+ public toaster: Toaster = new Toaster(this.routerHook);
private deckyState: DeckyState = new DeckyState();
private reloadLock: boolean = false;
@@ -233,13 +233,18 @@ class PluginLoader extends Logger {
},
});
if (res.ok) {
- let plugin_export = await eval(await res.text());
- let plugin = plugin_export(this.createPluginAPI(name));
- this.plugins.push({
- ...plugin,
- name: name,
- version: version,
- });
+ try {
+ let plugin_export = await eval(await res.text());
+ let plugin = plugin_export(this.createPluginAPI(name));
+ this.plugins.push({
+ ...plugin,
+ name: name,
+ version: version,
+ });
+ } catch (e) {
+ this.error('Error loading plugin ' + name, e);
+ this.toaster.toast({ title: 'Error loading ' + name, body: '' + e, icon: <FaExclamationCircle /> });
+ }
} else throw new Error(`${name} frontend_bundle not OK`);
}