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:
L-Sun
2025-05-06 03:30:49 +00:00
parent 1ca7109812
commit 29a7946585
@@ -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);