aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/RootStore.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/RootStore.tsx')
-rw-r--r--subprojects/frontend/src/RootStore.tsx21
1 files changed, 18 insertions, 3 deletions
diff --git a/subprojects/frontend/src/RootStore.tsx b/subprojects/frontend/src/RootStore.tsx
index 4a267b0e..e08dd750 100644
--- a/subprojects/frontend/src/RootStore.tsx
+++ b/subprojects/frontend/src/RootStore.tsx
@@ -1,16 +1,31 @@
1import { getLogger } from 'loglevel';
2import { makeObservable, observable, runInAction } from 'mobx';
1import React, { createContext, useContext } from 'react'; 3import React, { createContext, useContext } from 'react';
2 4
3import EditorStore from './editor/EditorStore'; 5import type EditorStore from './editor/EditorStore';
4import ThemeStore from './theme/ThemeStore'; 6import ThemeStore from './theme/ThemeStore';
5 7
8const log = getLogger('RootStore');
9
6export default class RootStore { 10export default class RootStore {
7 readonly editorStore: EditorStore; 11 editorStore: EditorStore | undefined;
8 12
9 readonly themeStore: ThemeStore; 13 readonly themeStore: ThemeStore;
10 14
11 constructor(initialValue: string) { 15 constructor(initialValue: string) {
12 this.editorStore = new EditorStore(initialValue);
13 this.themeStore = new ThemeStore(); 16 this.themeStore = new ThemeStore();
17 makeObservable(this, {
18 editorStore: observable,
19 });
20 import('./editor/EditorStore')
21 .then(({ default: EditorStore }) => {
22 runInAction(() => {
23 this.editorStore = new EditorStore(initialValue);
24 });
25 })
26 .catch((error) => {
27 log.error('Failed to load EditorStore', error);
28 });
14 } 29 }
15} 30}
16 31