soumaeda 2 лет назад
Родитель
Сommit
b13384559d

+ 4 - 1
apps/app/src/components/PageTags/TagEditModal.tsx

@@ -1,4 +1,4 @@
-import React, { useState, useCallback } from 'react';
+import React, { useState, useCallback, useEffect } from 'react';
 
 import { useTranslation } from 'next-i18next';
 import {
@@ -25,6 +25,9 @@ export const TagEditModal: React.FC = () => {
   const updateStateAfterSave = useUpdateStateAfterSave(pageId);
 
   const [tags, setTags] = useState<string[] | undefined>(initTags);
+  useEffect(() => {
+    setTags(initTags);
+  }, [initTags]);
   const handleSubmit = useCallback(async(newTags?: string[]) => {
 
     try {

+ 1 - 1
apps/app/src/components/PageTags/TagsInput.tsx

@@ -17,7 +17,7 @@ type TypeaheadInstance = {
 type Props = {
   tags?: string[],
   autoFocus: boolean,
-  onTagsUpdated: (tags?: string[] | undefined) => void,
+  onTagsUpdated: (tags: string[]) => void,
 }
 
 export const TagsInput: FC<Props> = (props: Props) => {