Use sentCounter in CompositionInput to drop old draft updates

This commit is contained in:
Scott Nonnenberg 2023-04-05 15:06:16 -07:00 committed by GitHub
parent 0e606c45b0
commit 4a18667ddf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 121 additions and 63 deletions

View file

@ -86,12 +86,7 @@ export function CompositionTextArea({
}, [inputApiRef]);
const handleChange = React.useCallback(
(
_conversationId: string | undefined,
newValue: string,
bodyRanges: DraftBodyRangesType,
caretLocation?: number | undefined
) => {
({ bodyRanges, caretLocation, messageText: newValue }) => {
const inputEl = inputApiRef.current;
if (!inputEl) {
return;
@ -124,21 +119,22 @@ export function CompositionTextArea({
return (
<div className="CompositionTextArea">
<CompositionInput
placeholder={placeholder}
clearQuotedMessage={shouldNeverBeCalled}
scrollerRef={scrollerRef}
draftText={draftText}
getPreferredBadge={getPreferredBadge}
getQuotedMessage={noop}
i18n={i18n}
inputApi={inputApiRef}
large
moduleClassName="CompositionTextArea__input"
onScroll={onScroll}
onEditorStateChange={handleChange}
onPickEmoji={onPickEmoji}
onScroll={onScroll}
onSubmit={onSubmit}
onTextTooLong={onTextTooLong}
draftText={draftText}
placeholder={placeholder}
scrollerRef={scrollerRef}
sendCounter={0}
theme={theme}
/>
<div className="CompositionTextArea__emoji">