fix: capture session.user.id before .then() callback to satisfy TS null check
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 43s

TS doesn't narrow session.user inside async callback closures.
Extract userId before the dynamic import to satisfy type checking.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 21:27:50 +02:00
parent e8a3957115
commit 007835c9bf
2 changed files with 4 additions and 2 deletions

View File

@@ -100,8 +100,9 @@ export function NoteInlineEditor({
useEffect(() => {
if (session?.user?.id) {
const userId = session.user.id
import('@/app/actions/ai-settings').then(({ getAISettings }) => {
getAISettings(session.user.id).then(settings => {
getAISettings(userId).then(settings => {
setAiAssistantEnabled(settings.paragraphRefactor !== false)
setAutoLabelingEnabled(settings.autoLabeling !== false)
}).catch(err => console.error("Failed to fetch AI settings", err))

View File

@@ -88,8 +88,9 @@ export function NoteInput({
useEffect(() => {
if (session?.user?.id) {
const userId = session.user.id
import('@/app/actions/ai-settings').then(({ getAISettings }) => {
getAISettings(session.user.id).then(settings => {
getAISettings(userId).then(settings => {
setAiAssistantEnabled(settings.paragraphRefactor !== false)
setAutoLabelingEnabled(settings.autoLabeling !== false)
}).catch(err => console.error("Failed to fetch AI settings", err))