Просмотр исходного кода

81100 add comment and fix propsType

SULLEY\ryo-h 4 лет назад
Родитель
Сommit
c47134d6d5

+ 2 - 0
packages/app/src/components/SearchPage.jsx

@@ -194,12 +194,14 @@ class SearchPage extends React.Component {
   toggleAllCheckBox = () => {
     if (this.state.selectedPages.size === this.state.searchedPages.length) {
       this.state.selectedPages.clear();
+      // Force a render to tell React that the State has been changed by the Set class method
       this.forceUpdate();
       return;
     }
     this.state.searchedPages.forEach((page) => {
       this.state.selectedPages.add(page);
     });
+    // Force a render to tell React that the State has been changed by the Set class method
     this.forceUpdate();
   };
 

+ 1 - 3
packages/app/src/components/SearchPage/SearchResultList.tsx

@@ -14,9 +14,7 @@ export type ISearchedPage = IPageHasId & {
 
 type Props = {
   pages: ISearchedPage[],
-  selectedPages: ISearchedPage[] & {
-    has: (page: ISearchedPage) => boolean,
-  },
+  selectedPages: Set<ISearchedPage>
   onClickInvoked?: (pageId: string) => void,
   onChangedInvoked?: (page: ISearchedPage) => void,
   searchResultCount?: number,

+ 1 - 0
packages/app/src/components/SearchPage/SearchResultListItem.tsx

@@ -74,6 +74,7 @@ type Props = {
 const SearchResultListItem: FC<Props> = (props:Props) => {
 
   const {
+    // todo: refactoring variable name to clear what changed - onClickInvoked, onChangedInvoked
     page, isSelected, onClickInvoked, onChangedInvoked, isChecked,
   } = props;