diff --git a/src/components/right/CreateTopic.tsx b/src/components/right/CreateTopic.tsx index 7182b0c0e..adf688cfa 100644 --- a/src/components/right/CreateTopic.tsx +++ b/src/components/right/CreateTopic.tsx @@ -1,5 +1,5 @@ import React, { - memo, useCallback, useMemo, useState, + memo, useCallback, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; @@ -60,6 +60,13 @@ const CreateTopic: FC = ({ onBack: onClose, }); + useEffect(() => { + if (!isActive) { + setTitle(''); + setIconEmojiId(undefined); + } + }, [isActive]); + const handleTitleChange = useCallback((e: React.ChangeEvent) => { setTitle(e.target.value); }, []); diff --git a/src/components/right/EditTopic.tsx b/src/components/right/EditTopic.tsx index ab68a7bd8..90f07813d 100644 --- a/src/components/right/EditTopic.tsx +++ b/src/components/right/EditTopic.tsx @@ -61,6 +61,13 @@ const EditTopic: FC = ({ onBack: onClose, }); + useEffect(() => { + if (!isActive) { + setTitle(''); + setIconEmojiId(undefined); + } + }, [isActive]); + useEffect(() => { if (topic?.title || topic?.iconEmojiId) { setTitle(topic.title);