mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
refactor: workspace manager (#5060)
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user