mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-13 04:42:56 +08:00
chore: add performance logger
This commit is contained in:
@@ -40,6 +40,7 @@ import { WorkspaceHeader } from '../../components/workspace-header';
|
||||
import { useBlockSuiteMetaHelper } from '../../hooks/affine/use-block-suite-meta-helper';
|
||||
import { useTrashModalHelper } from '../../hooks/affine/use-trash-modal-helper';
|
||||
import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace';
|
||||
import { performanceRenderLogger } from '../../shared';
|
||||
import * as styles from './all-page.css';
|
||||
import { EmptyPageList } from './page-list-empty';
|
||||
import { useFilteredPageMetas } from './pages';
|
||||
@@ -302,5 +303,7 @@ export const AllPage = () => {
|
||||
};
|
||||
|
||||
export const Component = () => {
|
||||
performanceRenderLogger.info('AllPage');
|
||||
|
||||
return <AllPage />;
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@ import { WorkspaceHeader } from '../../components/workspace-header';
|
||||
import { useRegisterBlocksuiteEditorCommands } from '../../hooks/affine/use-register-blocksuite-editor-commands';
|
||||
import { useCurrentWorkspace } from '../../hooks/current/use-current-workspace';
|
||||
import { useNavigateHelper } from '../../hooks/use-navigate-helper';
|
||||
import { performanceRenderLogger } from '../../shared';
|
||||
|
||||
const DetailPageImpl = (): ReactElement => {
|
||||
const { openPage, jumpToSubPath } = useNavigateHelper();
|
||||
@@ -145,5 +146,7 @@ export const loader: LoaderFunction = async args => {
|
||||
};
|
||||
|
||||
export const Component = () => {
|
||||
performanceRenderLogger.info('DetailPage');
|
||||
|
||||
return <DetailPage />;
|
||||
};
|
||||
|
||||
@@ -15,10 +15,17 @@ import {
|
||||
} from 'react-router-dom';
|
||||
|
||||
import { WorkspaceLayout } from '../../layouts/workspace-layout';
|
||||
import { performanceLogger, performanceRenderLogger } from '../../shared';
|
||||
|
||||
const workspaceLoaderLogger = performanceLogger.namespace('workspace_loader');
|
||||
|
||||
export const loader: LoaderFunction = async args => {
|
||||
workspaceLoaderLogger.info('start');
|
||||
|
||||
const rootStore = getCurrentStore();
|
||||
const meta = await rootStore.get(rootWorkspacesMetadataAtom);
|
||||
workspaceLoaderLogger.info('meta loaded');
|
||||
|
||||
const currentMetadata = meta.find(({ id }) => id === args.params.workspaceId);
|
||||
if (!currentMetadata) {
|
||||
return redirect('/404');
|
||||
@@ -32,6 +39,8 @@ export const loader: LoaderFunction = async args => {
|
||||
}
|
||||
if (currentMetadata.flavour === WorkspaceFlavour.AFFINE_CLOUD) {
|
||||
const [workspaceAtom] = getBlockSuiteWorkspaceAtom(currentMetadata.id);
|
||||
workspaceLoaderLogger.info('get cloud workspace atom');
|
||||
|
||||
const workspace = await rootStore.get(workspaceAtom);
|
||||
return (() => {
|
||||
const blockVersions = workspace.meta.blockVersions;
|
||||
@@ -46,10 +55,14 @@ export const loader: LoaderFunction = async args => {
|
||||
return false;
|
||||
})();
|
||||
}
|
||||
|
||||
workspaceLoaderLogger.info('done');
|
||||
return null;
|
||||
};
|
||||
|
||||
export const Component = (): ReactElement => {
|
||||
performanceRenderLogger.info('WorkspaceLayout');
|
||||
|
||||
const incompatible = useLoaderData();
|
||||
return (
|
||||
<WorkspaceLayout incompatible={!!incompatible}>
|
||||
|
||||
Reference in New Issue
Block a user