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
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:
@@ -100,8 +100,9 @@ export function NoteInlineEditor({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (session?.user?.id) {
|
if (session?.user?.id) {
|
||||||
|
const userId = session.user.id
|
||||||
import('@/app/actions/ai-settings').then(({ getAISettings }) => {
|
import('@/app/actions/ai-settings').then(({ getAISettings }) => {
|
||||||
getAISettings(session.user.id).then(settings => {
|
getAISettings(userId).then(settings => {
|
||||||
setAiAssistantEnabled(settings.paragraphRefactor !== false)
|
setAiAssistantEnabled(settings.paragraphRefactor !== false)
|
||||||
setAutoLabelingEnabled(settings.autoLabeling !== false)
|
setAutoLabelingEnabled(settings.autoLabeling !== false)
|
||||||
}).catch(err => console.error("Failed to fetch AI settings", err))
|
}).catch(err => console.error("Failed to fetch AI settings", err))
|
||||||
|
|||||||
@@ -88,8 +88,9 @@ export function NoteInput({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (session?.user?.id) {
|
if (session?.user?.id) {
|
||||||
|
const userId = session.user.id
|
||||||
import('@/app/actions/ai-settings').then(({ getAISettings }) => {
|
import('@/app/actions/ai-settings').then(({ getAISettings }) => {
|
||||||
getAISettings(session.user.id).then(settings => {
|
getAISettings(userId).then(settings => {
|
||||||
setAiAssistantEnabled(settings.paragraphRefactor !== false)
|
setAiAssistantEnabled(settings.paragraphRefactor !== false)
|
||||||
setAutoLabelingEnabled(settings.autoLabeling !== false)
|
setAutoLabelingEnabled(settings.autoLabeling !== false)
|
||||||
}).catch(err => console.error("Failed to fetch AI settings", err))
|
}).catch(err => console.error("Failed to fetch AI settings", err))
|
||||||
|
|||||||
Reference in New Issue
Block a user