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:
Keavon Chambers
2026-03-20 14:22:46 -07:00
committed by GitHub
parent 0c7b5cd534
commit 64fd12a1a0
19 changed files with 846 additions and 826 deletions
+7 -2
View File
@@ -35,15 +35,17 @@ if (import.meta.hot) import.meta.hot.data.store = store;
const { subscribe, update } = store;
export function createDocumentStore(editor: Editor) {
destroyDocumentStore();
editorRef = editor;
// Update layouts
editor.subscriptions.subscribeFrontendMessage("UpdateGraphFadeArtwork", (data) => {
update((state) => {
state.fadeArtwork = data.percentage;
return state;
});
});
editor.subscriptions.subscribeLayoutUpdate("ToolOptions", async (data) => {
await tick();
@@ -52,6 +54,7 @@ export function createDocumentStore(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeLayoutUpdate("DocumentBar", async (data) => {
await tick();
@@ -60,6 +63,7 @@ export function createDocumentStore(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeLayoutUpdate("ToolShelf", async (data) => {
await tick();
@@ -68,6 +72,7 @@ export function createDocumentStore(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeLayoutUpdate("WorkingColors", async (data) => {
await tick();
@@ -76,6 +81,7 @@ export function createDocumentStore(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeLayoutUpdate("NodeGraphControlBar", async (data) => {
await tick();
@@ -85,7 +91,6 @@ export function createDocumentStore(editor: Editor) {
});
});
// Show or hide the graph view overlay
editor.subscriptions.subscribeFrontendMessage("UpdateGraphViewOverlay", (data) => {
update((state) => {
state.graphViewOverlayOpen = data.open;