mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 15:46:29 +08:00
fix(editor): userProvider should be optional (#12137)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved stability of the toolbar menu by preventing errors when user information is unavailable. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -355,7 +355,8 @@ function createToolbarMoreMenuConfigV2(baseUrl?: string) {
|
||||
const createdByUserId = model.props[createdBy] as string;
|
||||
const createdAtTimestamp = model.props[createdAt] as number;
|
||||
const date = new Date(createdAtTimestamp);
|
||||
const userProvider = ctx.std.get(UserProvider);
|
||||
const userProvider = ctx.std.getOptional(UserProvider);
|
||||
if (!userProvider) return null;
|
||||
userProvider.revalidateUserInfo(createdByUserId);
|
||||
const userSignal = userProvider.userInfo$(createdByUserId);
|
||||
const isLoadingSignal = userProvider.isLoading$(createdByUserId);
|
||||
|
||||
Reference in New Issue
Block a user