Fix bug latency on commentThread title edition
This commit is contained in:
@ -89,9 +89,8 @@ export function CommentThread({
|
|||||||
});
|
});
|
||||||
const commentThread = data?.findManyCommentThreads[0];
|
const commentThread = data?.findManyCommentThreads[0];
|
||||||
|
|
||||||
const [title, setTitle] = useState<string | null | undefined>(
|
const [title, setTitle] = useState<string | null | undefined>(undefined);
|
||||||
commentThread?.title,
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
);
|
|
||||||
|
|
||||||
const [updateCommentThreadTitleMutation] =
|
const [updateCommentThreadTitleMutation] =
|
||||||
useUpdateCommentThreadTitleMutation();
|
useUpdateCommentThreadTitleMutation();
|
||||||
@ -120,10 +119,13 @@ export function CommentThread({
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (commentThread?.title) {
|
if (commentThread) {
|
||||||
setTitle(commentThread.title);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}, [commentThread?.title]);
|
if (isLoading) {
|
||||||
|
setTitle(commentThread?.title ?? '');
|
||||||
|
}
|
||||||
|
}, [commentThread, isLoading]);
|
||||||
|
|
||||||
if (!commentThread) {
|
if (!commentThread) {
|
||||||
return <></>;
|
return <></>;
|
||||||
|
|||||||
Reference in New Issue
Block a user