mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
feat: add workspace change event handler
This commit is contained in:
@@ -80,6 +80,17 @@ export const AppStateProvider = ({
|
||||
};
|
||||
}, [appState]);
|
||||
|
||||
useEffect(() => {
|
||||
const { dataCenter } = appState;
|
||||
// FIXME: onWorkspacesChange should have dispose function
|
||||
dataCenter?.onWorkspacesChange(() => {
|
||||
setAppState({
|
||||
...appState,
|
||||
workspaceList: dataCenter.workspaces,
|
||||
});
|
||||
});
|
||||
}, [appState]);
|
||||
|
||||
const loadPage = (pageId: string) => {
|
||||
const { currentWorkspace, currentPage } = appState;
|
||||
if (pageId === currentPage?.id) {
|
||||
|
||||
Reference in New Issue
Block a user