Topic: Cleaning the edit form (#3418)
This commit is contained in:
parent
a5ebc78d39
commit
c76e73b047
@ -1,5 +1,5 @@
|
|||||||
import React, {
|
import React, {
|
||||||
memo, useCallback, useMemo, useState,
|
memo, useCallback, useEffect, useMemo, useState,
|
||||||
} from '../../lib/teact/teact';
|
} from '../../lib/teact/teact';
|
||||||
import { getActions, withGlobal } from '../../global';
|
import { getActions, withGlobal } from '../../global';
|
||||||
|
|
||||||
@ -60,6 +60,13 @@ const CreateTopic: FC<OwnProps & StateProps> = ({
|
|||||||
onBack: onClose,
|
onBack: onClose,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isActive) {
|
||||||
|
setTitle('');
|
||||||
|
setIconEmojiId(undefined);
|
||||||
|
}
|
||||||
|
}, [isActive]);
|
||||||
|
|
||||||
const handleTitleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleTitleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setTitle(e.target.value);
|
setTitle(e.target.value);
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@ -61,6 +61,13 @@ const EditTopic: FC<OwnProps & StateProps> = ({
|
|||||||
onBack: onClose,
|
onBack: onClose,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isActive) {
|
||||||
|
setTitle('');
|
||||||
|
setIconEmojiId(undefined);
|
||||||
|
}
|
||||||
|
}, [isActive]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (topic?.title || topic?.iconEmojiId) {
|
if (topic?.title || topic?.iconEmojiId) {
|
||||||
setTitle(topic.title);
|
setTitle(topic.title);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user