Explorar el Código

remove fetching shortBodiesMap

Yuki Takei hace 4 años
padre
commit
623af6949f

+ 8 - 14
packages/app/src/components/SearchPage.jsx

@@ -40,7 +40,6 @@ class SearchPage extends React.Component {
       focusedSearchResultData: null,
       focusedSearchResultData: null,
       selectedPagesIdList: new Set(),
       selectedPagesIdList: new Set(),
       searchResultCount: 0,
       searchResultCount: 0,
-      shortBodiesMap: null,
       activePage: 1,
       activePage: 1,
       pagingLimit: this.props.appContainer.config.pageLimitationL || 50,
       pagingLimit: this.props.appContainer.config.pageLimitationL || 50,
       excludeUserPages: true,
       excludeUserPages: true,
@@ -152,11 +151,6 @@ class SearchPage extends React.Component {
     this.setState({ pagingLimit: limit }, () => this.search({ keyword: this.state.searchedKeyword }));
     this.setState({ pagingLimit: limit }, () => this.search({ keyword: this.state.searchedKeyword }));
   }
   }
 
 
-  async fetchShortBodiesMap(pageIds) {
-    const res = await apiv3Get('/page-listing/short-bodies', { pageIds });
-    this.setState({ shortBodiesMap: res.data.shortBodiesMap });
-  }
-
   // todo: refactoring
   // todo: refactoring
   // refs: https://redmine.weseek.co.jp/issues/82139
   // refs: https://redmine.weseek.co.jp/issues/82139
   async search(data) {
   async search(data) {
@@ -195,17 +189,18 @@ class SearchPage extends React.Component {
         order,
         order,
       });
       });
 
 
+      // TODO: fetch with /page-listing/info
+      // https://redmine.weseek.co.jp/issues/87695
       /*
       /*
        * non-await asynchronous short body fetch
        * non-await asynchronous short body fetch
        */
        */
-      const pageIds = res.data.map((page) => {
-        if (page.pageMeta?.elasticSearchResult != null && page.pageMeta?.elasticSearchResult?.snippet.length !== 0) {
-          return null;
-        }
+      // const pageIds = res.data.map((page) => {
+      //   if (page.pageMeta?.elasticSearchResult != null && page.pageMeta?.elasticSearchResult?.snippet.length !== 0) {
+      //     return null;
+      //   }
 
 
-        return page.pageData._id;
-      }).filter(id => id != null);
-      this.fetchShortBodiesMap(pageIds);
+      //   return page.pageData._id;
+      // }).filter(id => id != null);
 
 
       this.changeURL(keyword);
       this.changeURL(keyword);
       if (res.data.length > 0) {
       if (res.data.length > 0) {
@@ -324,7 +319,6 @@ class SearchPage extends React.Component {
         focusedSearchResultData={this.state.focusedSearchResultData}
         focusedSearchResultData={this.state.focusedSearchResultData}
         selectedPagesIdList={this.state.selectedPagesIdList || []}
         selectedPagesIdList={this.state.selectedPagesIdList || []}
         searchResultCount={this.state.searchResultCount}
         searchResultCount={this.state.searchResultCount}
-        shortBodiesMap={this.state.shortBodiesMap}
         activePage={this.state.activePage}
         activePage={this.state.activePage}
         pagingLimit={this.state.pagingLimit}
         pagingLimit={this.state.pagingLimit}
         onClickItem={this.selectPage}
         onClickItem={this.selectPage}

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

@@ -13,7 +13,6 @@ type Props = {
   searchResultCount?: number,
   searchResultCount?: number,
   activePage?: number,
   activePage?: number,
   pagingLimit?: number,
   pagingLimit?: number,
-  shortBodiesMap?: Record<string, string>
   focusedSearchResultData?: IPageWithMeta<IPageSearchMeta>,
   focusedSearchResultData?: IPageWithMeta<IPageSearchMeta>,
   onPagingNumberChanged?: (activePage: number) => void,
   onPagingNumberChanged?: (activePage: number) => void,
   onClickItem?: (pageId: string) => void,
   onClickItem?: (pageId: string) => void,
@@ -24,7 +23,7 @@ type Props = {
 
 
 const SearchResultList: FC<Props> = (props:Props) => {
 const SearchResultList: FC<Props> = (props:Props) => {
   const {
   const {
-    focusedSearchResultData, selectedPagesIdList, isEnableActions, shortBodiesMap,
+    focusedSearchResultData, selectedPagesIdList, isEnableActions,
   } = props;
   } = props;
 
 
   const focusedPageId = (focusedSearchResultData != null && focusedSearchResultData.pageData != null) ? focusedSearchResultData.pageData._id : '';
   const focusedPageId = (focusedSearchResultData != null && focusedSearchResultData.pageData != null) ? focusedSearchResultData.pageData._id : '';
@@ -38,7 +37,6 @@ const SearchResultList: FC<Props> = (props:Props) => {
             key={page.pageData._id}
             key={page.pageData._id}
             page={page}
             page={page}
             isEnableActions={isEnableActions}
             isEnableActions={isEnableActions}
-            shortBody={shortBodiesMap?.[page.pageData._id]}
             onClickItem={props.onClickItem}
             onClickItem={props.onClickItem}
             onClickCheckbox={props.onClickCheckbox}
             onClickCheckbox={props.onClickCheckbox}
             isChecked={isChecked}
             isChecked={isChecked}