fix(team): clear sent composer draft before paint
This commit is contained in:
parent
066ffe79ef
commit
032ddbbe2c
1 changed files with 6 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { api } from '@renderer/api';
|
import { api } from '@renderer/api';
|
||||||
import { AttachmentPreviewList } from '@renderer/components/team/attachments/AttachmentPreviewList';
|
import { AttachmentPreviewList } from '@renderer/components/team/attachments/AttachmentPreviewList';
|
||||||
|
|
@ -379,11 +379,14 @@ export const MessageComposer = ({
|
||||||
selectedTeam,
|
selectedTeam,
|
||||||
draft.attachments,
|
draft.attachments,
|
||||||
draft.chips,
|
draft.chips,
|
||||||
|
draft.text,
|
||||||
taskSuggestions,
|
taskSuggestions,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Clear draft only after send completes successfully (sending: true → false, no error)
|
// Clear draft only after send completes successfully (sending: true -> false, no error).
|
||||||
useEffect(() => {
|
// Layout effect prevents a visible paint where the optimistic message is already in the list
|
||||||
|
// but the submitted text is still shown in the composer.
|
||||||
|
useLayoutEffect(() => {
|
||||||
if (!sending && pendingSendRef.current) {
|
if (!sending && pendingSendRef.current) {
|
||||||
pendingSendRef.current = false;
|
pendingSendRef.current = false;
|
||||||
if (!sendError && sendDebugDetails?.delivered !== false) {
|
if (!sendError && sendDebugDetails?.delivered !== false) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue