mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-17 12:21:49 +03:00
34703a3b7d
https://github.com/toeverything/AFFiNE/blob/eyhn/feat/new-sync/packages/common/infra/src/workspace/engine/doc/README.md
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import './polyfill/dispose';
|
|
// Side effect import, "declare global"
|
|
import '@affine/env/constant';
|
|
|
|
import { setup } from '@affine/core/bootstrap/setup';
|
|
import { performanceLogger } from '@affine/core/shared';
|
|
import { StrictMode } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
|
|
import { App } from './app';
|
|
|
|
const performanceMainLogger = performanceLogger.namespace('main');
|
|
function main() {
|
|
performanceMainLogger.info('start');
|
|
|
|
// skip bootstrap setup for desktop onboarding
|
|
if (window.appInfo?.windowName === 'onboarding') {
|
|
performanceMainLogger.info('skip setup');
|
|
} else {
|
|
performanceMainLogger.info('setup start');
|
|
setup();
|
|
performanceMainLogger.info('setup done');
|
|
}
|
|
|
|
mountApp();
|
|
}
|
|
|
|
function mountApp() {
|
|
performanceMainLogger.info('import app');
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
const root = document.getElementById('app')!;
|
|
performanceMainLogger.info('render app');
|
|
createRoot(root).render(
|
|
<StrictMode>
|
|
<App />
|
|
</StrictMode>
|
|
);
|
|
}
|
|
|
|
try {
|
|
main();
|
|
} catch (err) {
|
|
console.error('Failed to bootstrap app', err);
|
|
}
|