feat: add workspace change event handler
This commit is contained in:
@@ -80,6 +80,17 @@ export const AppStateProvider = ({
|
|||||||
};
|
};
|
||||||
}, [appState]);
|
}, [appState]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const { dataCenter } = appState;
|
||||||
|
// FIXME: onWorkspacesChange should have dispose function
|
||||||
|
dataCenter?.onWorkspacesChange(() => {
|
||||||
|
setAppState({
|
||||||
|
...appState,
|
||||||
|
workspaceList: dataCenter.workspaces,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, [appState]);
|
||||||
|
|
||||||
const loadPage = (pageId: string) => {
|
const loadPage = (pageId: string) => {
|
||||||
const { currentWorkspace, currentPage } = appState;
|
const { currentWorkspace, currentPage } = appState;
|
||||||
if (pageId === currentPage?.id) {
|
if (pageId === currentPage?.id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user