Skip to content

Commit

Permalink
Fixed strange bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CEbbinghaus committed Oct 31, 2023
1 parent 4e91dbb commit 3196c83
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ export default definePlugin((serverApi: ServerAPI) => {
exact: true,
});

const microSDeckManager = window.MicroSDeck = (window.MicroSDeck || new MicroSDeckManager({url: API_URL}));
if(window.MicroSDeck) {
window.MicroSDeck.destruct();
}
window.MicroSDeck = new MicroSDeckManager({url: API_URL, logger: Logger});

DeckyAPI.SetApi(serverApi);

Expand All @@ -176,17 +179,14 @@ export default definePlugin((serverApi: ServerAPI) => {
return {
title: <div className={staticClasses.Title}>Example Plugin</div>,
content:
<MicroSDeckContextProvider microSDeckManager={microSDeckManager}>
<MicroSDeckContextProvider microSDeckManager={window.MicroSDeck}>
<Content />
</MicroSDeckContextProvider>,
icon: <FaSdCard />,
onDismount() {
serverApi.routerHook.removeRoute(DOCUMENTATION_PATH);
patch && serverApi.routerHook.removePatch('/library/app/:appid', patch);

//@ts-ignore
window.MicroSDeck = null;
microSDeckManager.destruct();
window.MicroSDeck = undefined;
},
};
});

0 comments on commit 3196c83

Please sign in to comment.