mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added new admin routes: "auth", "setup", and "notFound" for improved navigation and access within the admin interface. - Introduced a utility for simplified and flexible lazy loading of React components with fallback support. - **Improvements** - Updated routing structure in the admin frontend for clearer route management and enhanced Sentry integration. - Centralized route definitions for easier maintenance and consistency. - Upgraded dependencies to support the latest React Router and React versions. - Enhanced asynchronous handling in setup form navigation. - **Chores** - Updated project references and workspace dependencies for better package management. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Routes
Usage
Path Factories
import { FACTORIES } from '@affine/routes';
const path = FACTORIES.workspace.doc({ workspaceId: '123', docId: '456' });
// ^^^^ with typecheck
Register router
import { ROUTES } from '@affine/routes';
function Routes() {
return <Router path={ROUTES.admin.index} element={} />;
}
Path Parameter
import { RouteParamsTypes } from '@affine/routes';
function Doc() {
const { workspaceId, docId } = useParams<RouteParamsTypes['workspace']['doc']>();
}
function Attachment() {
const { workspaceId, docId, attachmentId } = useParams<RouteParamsTypes['workspace']['doc']['attachment']>();
}