perf: optimize Tasker boot and kanban load
This commit is contained in:
@@ -7,14 +7,21 @@
|
||||
// store
|
||||
import { CoreRootStore } from "@/store/root.store";
|
||||
import type { ITimelineStore } from "./timeline";
|
||||
import { TimeLineStore } from "./timeline";
|
||||
|
||||
export class RootStore extends CoreRootStore {
|
||||
timelineStore: ITimelineStore;
|
||||
timelineStore: ITimelineStore | undefined;
|
||||
private timelineStorePromise: Promise<ITimelineStore> | undefined;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
loadTimelineStore = async (): Promise<ITimelineStore> => {
|
||||
if (this.timelineStore) return this.timelineStore;
|
||||
|
||||
this.timelineStore = new TimeLineStore(this);
|
||||
if (!this.timelineStorePromise) {
|
||||
this.timelineStorePromise = import("./timeline").then(({ TimeLineStore }) => {
|
||||
this.timelineStore = new TimeLineStore(this);
|
||||
return this.timelineStore;
|
||||
});
|
||||
}
|
||||
|
||||
return this.timelineStorePromise;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user