Add explicit useEffect to sync height on value changes

- Ensures syncDisplayHeight runs whenever value prop changes
- Fixes issue where height wasn't recalculating on text deletion
- Complements existing ResizeObserver with direct value monitoring
This commit is contained in:
spencrmartin
2025-10-31 09:22:26 -04:00
parent 9a31c2eda9
commit fd830cdfec
@@ -1006,6 +1006,12 @@ export const RichChatInput = forwardRef<RichChatInputRef, RichChatInputProps>(({
const cleanup = monitorTextareaChanges();
return cleanup;
}, [monitorTextareaChanges]);
// Explicitly sync height whenever value changes (including when text is deleted)
useEffect(() => {
syncDisplayHeight();
ensureStyleConsistency();
}, [value, syncDisplayHeight, ensureStyleConsistency]);
// Tooltip handlers
const handleSuggestionSelect = useCallback((suggestion: string) => {
const newValue = value.slice(0, tooltip.wordStart) +