fix(panels): eliminate getSession() from transcription store and cabinets panel
Same GoTrueClient lock contention fix as CCFilesPanel: - transcriptionStore: add _accessToken/_userId state + setAuthInfo() action; replace all 6 getSession() calls (startSession, flushCanvasEvents, loadSessions, loadKeywordWatches, addKeywordWatch, deleteKeywordWatch, checkSegmentForKeywords) with stored values — zero getSession() calls remain in the store - CCTranscriptionPanel: destructure accessToken from useAuth; sync both values into store via setAuthInfo() on every auth change; gate loadSessions on authUser.id - CCCabinetsPanel: same pattern as CCFilesPanel — useAuth for token, useCallback on apiFetch/loadCabinets, gate effect on authUser.id Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -67,6 +67,7 @@ export const CCTranscriptionPanel: React.FC = () => {
|
||||
flushCanvasEvents,
|
||||
loadSessions,
|
||||
setTimetableContext,
|
||||
setAuthInfo,
|
||||
llmConfig,
|
||||
summaryText,
|
||||
isGeneratingSummary,
|
||||
@@ -93,7 +94,7 @@ export const CCTranscriptionPanel: React.FC = () => {
|
||||
|
||||
// Modal state
|
||||
const [showSettingsModal, setShowSettingsModal] = useState(false);
|
||||
const { user: authUser } = useAuth();
|
||||
const { user: authUser, accessToken } = useAuth();
|
||||
const [showSummaryModal, setShowSummaryModal] = useState(false);
|
||||
const [summaryType, setSummaryType] = useState('full_lesson');
|
||||
|
||||
@@ -101,6 +102,11 @@ export const CCTranscriptionPanel: React.FC = () => {
|
||||
const [newKeyword, setNewKeyword] = useState('');
|
||||
const [isAddingKeyword, setIsAddingKeyword] = useState(false);
|
||||
|
||||
// Sync access token into Zustand store so all store actions can use it without getSession()
|
||||
useEffect(() => {
|
||||
setAuthInfo(accessToken, authUser?.id ?? null);
|
||||
}, [accessToken, authUser?.id, setAuthInfo]);
|
||||
|
||||
// Load sessions when auth is confirmed (avoids GoTrueClient lock on mount)
|
||||
useEffect(() => {
|
||||
if (authUser?.id) {
|
||||
|
||||
Reference in New Issue
Block a user