fix: boucle infinie Maximum update depth dans useAutoTagging + toolbar
Some checks failed
CI / Deploy production (on server) (push) Has been cancelled
CI / Lint, Unit Tests & Build (push) Has been cancelled

- use-auto-tagging: onQuotaExceeded via ref stable → n'invalide plus
  useCallback analyzeContent à chaque render parent
- note-editor-context: filteredSuggestions et existingLabelsLower
  stabilisés avec useMemo (était recalculé sans memo → nouvelle ref
  à chaque render → état useMemo state se réexécutait → boucle)
- deepseek.ts: generateTags via generateText (pas generateObject)
  pour éviter response_format:json_schema non supporté

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Antigravity
2026-05-29 13:40:59 +00:00
parent 1e00b01bc3
commit b825bdb8b2
3 changed files with 26 additions and 17 deletions

View File

@@ -211,11 +211,15 @@ export function NoteEditorProvider({ note, readOnly = false, fullPage = false, o
const [comparisonNotes, setComparisonNotes] = useState<Array<Partial<Note>>>([])
const [fusionNotes, setFusionNotes] = useState<Array<Partial<Note>>>([])
const existingLabelsLower = (note.labels || []).map((l) => l.toLowerCase())
const filteredSuggestions = suggestions.filter(s => {
const existingLabelsLower = useMemo(
() => (note.labels || []).map((l) => l.toLowerCase()),
// eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(note.labels)]
)
const filteredSuggestions = useMemo(() => suggestions.filter(s => {
if (!s || !s.tag) return false
return !dismissedTags.includes(s.tag) && !existingLabelsLower.includes(s.tag.toLowerCase())
})
}), [suggestions, dismissedTags, existingLabelsLower])
const colorClasses = NOTE_COLORS[color as NoteColor] || NOTE_COLORS.default