|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useState } from 'react';
|
|
|
|
|
|
|
+import React, { useState, useEffect } from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import {
|
|
import {
|
|
@@ -8,12 +8,16 @@ import {
|
|
|
import TagsInput from './TagsInput';
|
|
import TagsInput from './TagsInput';
|
|
|
|
|
|
|
|
function TagEditModal(props) {
|
|
function TagEditModal(props) {
|
|
|
- const [tags, setTags] = useState(['hoge']);
|
|
|
|
|
|
|
+ const [tags, setTags] = useState([]);
|
|
|
|
|
|
|
|
function onTagsUpdatedByTagsInput(tags) {
|
|
function onTagsUpdatedByTagsInput(tags) {
|
|
|
setTags(tags);
|
|
setTags(tags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ setTags(props.tags);
|
|
|
|
|
+ }, [props.tags]);
|
|
|
|
|
+
|
|
|
function closeModalHandler() {
|
|
function closeModalHandler() {
|
|
|
if (props.onClose == null) {
|
|
if (props.onClose == null) {
|
|
|
return;
|
|
return;
|
|
@@ -49,6 +53,7 @@ function TagEditModal(props) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TagEditModal.propTypes = {
|
|
TagEditModal.propTypes = {
|
|
|
|
|
+ tags: PropTypes.array,
|
|
|
isOpen: PropTypes.bool.isRequired,
|
|
isOpen: PropTypes.bool.isRequired,
|
|
|
onClose: PropTypes.func,
|
|
onClose: PropTypes.func,
|
|
|
onTagsUpdated: PropTypes.func,
|
|
onTagsUpdated: PropTypes.func,
|