feat: run app in closure (#3790)

This commit is contained in:
Alex Yang
2023-08-18 14:50:35 -05:00
committed by GitHub
parent bd826bb7f9
commit e6cd193bf4
18 changed files with 632 additions and 553 deletions

View File

@@ -6,7 +6,19 @@ import { atom, createStore } from 'jotai/vanilla';
import { getWorkspace, waitForWorkspace } from './__internal__/workspace.js';
// global store
export const rootStore = createStore();
let rootStore = createStore();
export function getCurrentStore() {
return rootStore;
}
/**
* @internal do not use this function unless you know what you are doing
*/
export function _setCurrentStore(store: ReturnType<typeof createStore>) {
rootStore = store;
}
export const loadedPluginNameAtom = atom<string[]>([]);
export const currentWorkspaceIdAtom = atom<string | null>(null);