Clearing form when closing Tag edit modal.

This commit is contained in:
Roland 2023-04-06 11:04:59 -06:00
parent a5da49a135
commit e71f17749a
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93

View file

@ -4,7 +4,8 @@ import {
Button as SButton,
Confirm,
Dimmer,
Divider, Dropdown,
Divider,
Dropdown,
Form,
FormInput,
Grid,
@ -164,6 +165,13 @@ function EditTagsModal() {
const [tagColor, setTagColor] = useState(DEFAULT_TAG_COLOR);
const textColor = contrastingColor(tagColor);
const localOnClose = () => {
setOpen(false);
setTagName('');
setTagColor(null);
setTagId(null);
}
const localDeleteTag = async (id, name) => {
await deleteTag(id, name);
if (fetchTags) {
@ -197,7 +205,7 @@ function EditTagsModal() {
<Modal closeIcon
open={open}
onOpen={() => setOpen(true)}
onClose={() => setOpen(false)}
onClose={localOnClose}
>
<Modal.Header>Edit Tags</Modal.Header>
<Modal.Content>
@ -389,11 +397,3 @@ export const TagsDropdown = ({value = [], onChange, ...props}) => {
{...props}
/>
}
export const TagsProvider = ({children}) => {
const value = useTagsInterval();
return <TagsContext.Provider value={value}>
{children}
</TagsContext.Provider>
}