fix: update dependencies in effect hooks for improved reactivity

This commit is contained in:
自由的世界人 2025-07-10 15:27:00 +08:00
parent 88f0596a1f
commit bb6734c628
3 changed files with 3 additions and 3 deletions

View File

@ -157,7 +157,7 @@ const PreviewSectionComponent: React.FC<PreviewSectionProps> = ({ html, visible
clearInterval(intervalRef.current)
}
}
}, []) // 只在组件挂载时执行一次
}, [htmlContent]) // 只在组件挂载时执行一次
if (!visible) return null
const isHtmlEmpty = !debouncedHtml.trim()

View File

@ -128,7 +128,7 @@ export const QuickPanelView: React.FC<Props> = ({ setInputText }) => {
prevSymbolRef.current = ctx.symbol
return newList
}, [ctx.defaultIndex, ctx.isVisible, ctx.list, ctx.symbol, searchText])
}, [ctx.isVisible, ctx.list, ctx.symbol, searchText])
const canForwardAndBackward = useMemo(() => {
return list.some((item) => item.isMenu) || historyPanel.length > 0

View File

@ -43,7 +43,7 @@ const QuotaTag: FC<{ base: KnowledgeBase; providerId: string; quota?: number }>
return
}
checkQuota()
}, [_quota, base, provider.id, provider.apiKey])
}, [_quota, base, provider.id, provider.apiKey, quota, updateProvider])
return (
<>