Fix login (#844)

* Fix login

* Fix according to PR

* Fix tests

* Fix tests
This commit is contained in:
Charles Bochet
2023-07-22 19:43:28 -07:00
committed by GitHub
parent c4468d60f6
commit 4ac01f2931
10 changed files with 15 additions and 47 deletions

View File

@ -92,24 +92,23 @@ export function CommentThread({
showComment = true,
autoFillTitle = false,
}: OwnProps) {
const { data, loading } = useGetCommentThreadQuery({
const { data } = useGetCommentThreadQuery({
variables: {
commentThreadId: commentThreadId ?? '',
},
skip: !commentThreadId,
});
const commentThread = data?.findManyCommentThreads[0];
const [hasUserManuallySetTitle, setHasUserManuallySetTitle] =
useState<boolean>(false);
const [title, setTitle] = useState<string | null>(null);
useEffect(() => {
if (!loading) {
if (!hasUserManuallySetTitle) {
setTitle(commentThread?.title ?? '');
}
}, [loading, setTitle, commentThread?.title]);
const [hasUserManuallySetTitle, setHasUserManuallySetTitle] =
useState<boolean>(false);
}, [setTitle, commentThread?.title, hasUserManuallySetTitle]);
const [updateCommentThreadMutation] = useUpdateCommentThreadMutation();