mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 12:38:11 +08:00
Break out helper functions from the frontend's managers and stores (#3920)
* Move destructor call to each manager/store constructor for safety * Break out utility functions
This commit is contained in:
@@ -4,6 +4,8 @@ import { createCrashDialog } from "@graphite/stores/dialog";
|
||||
let editorRef: Editor | undefined = undefined;
|
||||
|
||||
export function createPanicManager(editor: Editor) {
|
||||
destroyPanicManager();
|
||||
|
||||
editorRef = editor;
|
||||
|
||||
editor.subscriptions.subscribeFrontendMessage("DisplayDialogPanic", (data) => {
|
||||
@@ -31,6 +33,5 @@ export function destroyPanicManager() {
|
||||
|
||||
// Self-accepting HMR: tear down the old instance and re-create with the new module's code
|
||||
import.meta.hot?.accept((newModule) => {
|
||||
destroyPanicManager();
|
||||
if (editorRef) newModule?.createPanicManager(editorRef);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user