refactor: workspace manager (#5060)

This commit is contained in:
EYHN
2023-12-15 07:20:50 +00:00
parent af15aa06d4
commit fe2851d3e9
217 changed files with 3605 additions and 4244 deletions
+10 -11
View File
@@ -2,23 +2,23 @@ import './polyfill/ses-lockdown';
import './polyfill/intl-segmenter';
import './polyfill/request-idle-callback';
import { WorkspaceFallback } from '@affine/component/workspace';
import { assertExists } from '@blocksuite/global/utils';
import { getCurrentStore } from '@toeverything/infra/atom';
import { StrictMode, Suspense } from 'react';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { App } from './app';
import { bootstrapPluginSystem } from './bootstrap/register-plugins';
import { setup } from './bootstrap/setup';
import { performanceLogger } from './shared';
const performanceMainLogger = performanceLogger.namespace('main');
async function main() {
function main() {
performanceMainLogger.info('start');
const { setup } = await import('./bootstrap/setup');
const rootStore = getCurrentStore();
performanceMainLogger.info('setup start');
await setup(rootStore);
setup();
performanceMainLogger.info('setup done');
bootstrapPluginSystem(rootStore).catch(err => {
@@ -26,20 +26,19 @@ async function main() {
});
performanceMainLogger.info('import app');
const { App } = await import('./app');
const root = document.getElementById('app');
assertExists(root);
performanceMainLogger.info('render app');
createRoot(root).render(
<StrictMode>
<Suspense fallback={<WorkspaceFallback key="AppLoading" />}>
<App />
</Suspense>
<App />
</StrictMode>
);
}
main().catch(err => {
try {
main();
} catch (err) {
console.error('Failed to bootstrap app', err);
});
}