Skip to content

Commit c22568e

Browse files
committed
fix: template context
1 parent 4d39745 commit c22568e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/database/components/cell/person/useMentionableUsers.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { useCallback, useEffect, useRef, useState } from 'react';
1+
import { useCallback, useContext, useEffect, useRef, useState } from 'react';
22

33
import { MentionablePerson } from '@/application/types';
4-
import { useCurrentWorkspaceId } from '@/components/app/app.hooks';
4+
import { AppContext } from '@/components/app/app.hooks';
55
import { useService } from '@/components/main/app.hooks';
66

77
interface CacheEntry {
@@ -27,7 +27,9 @@ function getCachedUsers(workspaceId: string | undefined): MentionablePerson[] {
2727

2828
export function useMentionableUsers() {
2929
const service = useService();
30-
const workspaceId = useCurrentWorkspaceId();
30+
// Use AppContext directly to avoid throwing when outside AppProvider (e.g., in publish view)
31+
const appContext = useContext(AppContext);
32+
const workspaceId = appContext?.currentWorkspaceId;
3133

3234
// Track current workspaceId for race condition prevention
3335
const workspaceIdRef = useRef(workspaceId);

0 commit comments

Comments
 (0)