Fix flashing title for note (#761)

* Fix flashing title for note

* Remove unused check

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Emilien Chauvet
2023-07-19 15:05:54 -07:00
committed by GitHub
parent 411266475d
commit d7efed9f89

View File

@ -100,7 +100,7 @@ export function CommentThread({
}); });
const commentThread = data?.findManyCommentThreads[0]; const commentThread = data?.findManyCommentThreads[0];
const [title, setTitle] = useState<string | null | undefined>(undefined); const [title, setTitle] = useState<string | null>(null);
const [hasUserManuallySetTitle, setHasUserManuallySetTitle] = const [hasUserManuallySetTitle, setHasUserManuallySetTitle] =
useState<boolean>(false); useState<boolean>(false);
@ -128,10 +128,10 @@ export function CommentThread({
} }
useEffect(() => { useEffect(() => {
if (commentThread && !title) { if (commentThread) {
setTitle(commentThread?.title ?? ''); setTitle(commentThread?.title ?? '');
} }
}, [commentThread, title]); }, [commentThread]);
if (!commentThread) { if (!commentThread) {
return <></>; return <></>;