SULLEY\ryo-h 4 лет назад
Родитель
Сommit
c355004c7c
1 измененных файлов с 6 добавлено и 6 удалено
  1. 6 6
      packages/app/src/components/SearchPage.jsx

+ 6 - 6
packages/app/src/components/SearchPage.jsx

@@ -192,16 +192,16 @@ class SearchPage extends React.Component {
   }
   }
 
 
   toggleAllCheckBox = () => {
   toggleAllCheckBox = () => {
-    if (this.state.selectedPagesIdList.size === this.state.searchedPages.length) {
-      this.state.selectedPagesIdList.clear();
+    const { selectedPagesIdList, searchedPages } = this.state;
+    if (selectedPagesIdList.size === searchedPages.length) {
+      selectedPagesIdList.clear();
     }
     }
     else {
     else {
-      this.state.searchedPages.forEach((page) => {
-        this.state.selectedPagesIdList.add(page._id);
+      searchedPages.forEach((page) => {
+        selectedPagesIdList.add(page._id);
       });
       });
     }
     }
-    // Force a render to tell React that the State has been changed by the Set class method
-    this.forceUpdate();
+    this.setState({ selectedPagesIdList });
   };
   };
 
 
   renderSearchResultContent = () => {
   renderSearchResultContent = () => {