@@ -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);
});
};
@@ -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,
@@ -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;