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:
2026-05-25 15:13:37 +01:00
co-authored by Claude Sonnet 4.6
parent 6bd85671d2
commit 3a65cf436b
3 changed files with 51 additions and 31 deletions
@@ -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) {