Skip to content

Commit

Permalink
remove unused articlecount query from categoryList
Browse files Browse the repository at this point in the history
  • Loading branch information
Anu-Ujin committed Dec 11, 2023
1 parent e721839 commit 077bebf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import ArticleForm from '../containers/article/ArticleForm';
import ArticleList from '../containers/article/ArticleList';
import Button from '@erxes/ui/src/components/Button';
import { ICategory } from '@erxes/ui-knowledgeBase/src/types';
import KnowledgeList from '../containers/knowledge/KnowledgeList';
import ModalTrigger from '@erxes/ui/src/components/ModalTrigger';
import Pagination from '@erxes/ui/src/components/pagination/Pagination';
import React from 'react';
import { Title } from '@erxes/ui/src/styles/main';
import { __ } from '@erxes/ui/src/utils/core';
import Wrapper from '@erxes/ui/src/layout/components/Wrapper';
import React from 'react';
import ArticleForm from '../containers/article/ArticleForm';
import ArticleList from '../containers/article/ArticleList';
import KnowledgeList from '../containers/knowledge/KnowledgeList';
import { ICategory } from '@erxes/ui-knowledgeBase/src/types';
import { __ } from '@erxes/ui/src/utils/core';

type Props = {
queryParams: any;
Expand Down Expand Up @@ -112,7 +112,7 @@ class KnowledgeBase extends React.Component<Props> {
}
/>
}
hasBorder
hasBorder={true}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from 'react';
import { ICategory } from '@erxes/ui-knowledgeBase/src/types';
import CategoryRow from './CategoryRow';
import { Categories } from './styles';
import CategoryRow from './CategoryRow';
import { ICategory } from '@erxes/ui-knowledgeBase/src/types';
import React from 'react';

type Props = {
currentCategoryId: string;
topicId: string;
categories: ICategory[];
articlesCount: number;
remove: (categoryId: string) => void;
queryParams?: any;
};
Expand All @@ -24,19 +23,12 @@ class CategoryList extends React.Component<Props> {
};

renderRow(category, isChild, isParent?) {
const {
remove,
currentCategoryId,
topicId,
articlesCount,
queryParams
} = this.props;
const { remove, currentCategoryId, topicId, queryParams } = this.props;

return (
<CategoryRow
key={category._id}
isActive={currentCategoryId === category._id}
articlesCount={articlesCount}
topicId={topicId}
category={category}
queryParams={queryParams}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { ActionButtons } from '@erxes/ui-settings/src/styles';
import Button from '@erxes/ui/src/components/Button';
import CategoryForm from '../../containers/category/CategoryForm';
import { CategoryItem } from './styles';
import { ICategory } from '@erxes/ui-knowledgeBase/src/types';
import Icon from '@erxes/ui/src/components/Icon';
import { Link } from 'react-router-dom';
import ModalTrigger from '@erxes/ui/src/components/ModalTrigger';
import React from 'react';
import Tip from '@erxes/ui/src/components/Tip';
import { __ } from '@erxes/ui/src/utils/core';
import React from 'react';
import { Link } from 'react-router-dom';
import CategoryForm from '../../containers/category/CategoryForm';
import { ICategory } from '@erxes/ui-knowledgeBase/src/types';
import { CategoryItem } from './styles';
import { ActionButtons } from '@erxes/ui-settings/src/styles';

type Props = {
topicId: string;
category: ICategory;
articlesCount: number;
remove: (categoryId: string) => void;
isActive: boolean;
isChild?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { gql } from '@apollo/client';
import * as compose from 'lodash.flowright';

import { Alert, confirm } from '@erxes/ui/src/utils';
import React from 'react';
import { graphql } from '@apollo/client/react/hoc';
import CategoryList from '../../components/category/CategoryList';
import { mutations, queries } from '@erxes/ui-knowledgebase/src/graphql';
import {
ArticlesTotalCountQueryResponse,
CategoriesQueryResponse,
CategoriesTotalCountQueryResponse,
RemoveCategoriesMutationResponse
} from '@erxes/ui-knowledgebase/src/types';
import { mutations, queries } from '@erxes/ui-knowledgebase/src/graphql';

import CategoryList from '../../components/category/CategoryList';
import React from 'react';
import { gql } from '@apollo/client';
import { graphql } from '@apollo/client/react/hoc';

type Props = {
currentCategoryId: string;
Expand All @@ -21,7 +22,6 @@ type Props = {
type FinalProps = {
categoriesQuery: CategoriesQueryResponse;
categoriesCountQuery: CategoriesTotalCountQueryResponse;
articlesCountQuery: ArticlesTotalCountQueryResponse;
} & Props &
RemoveCategoriesMutationResponse;

Expand All @@ -30,7 +30,6 @@ const KnowledgeBaseContainer = (props: FinalProps) => {
currentCategoryId,
categoriesQuery,
categoriesCountQuery,
articlesCountQuery,
removeCategoriesMutation,
topicId,
queryParams
Expand Down Expand Up @@ -62,8 +61,7 @@ const KnowledgeBaseContainer = (props: FinalProps) => {
queryParams,
categories: categoriesQuery.knowledgeBaseCategories || [],
loading: categoriesQuery.loading,
topicsCount: categoriesCountQuery.knowledgeBaseCategoriesTotalCount || 0,
articlesCount: articlesCountQuery.knowledgeBaseArticlesTotalCount || 0
topicsCount: categoriesCountQuery.knowledgeBaseCategoriesTotalCount || 0
};

return <CategoryList {...extendedProps} />;
Expand All @@ -83,15 +81,6 @@ export default compose(
}
}
),
graphql<Props, ArticlesTotalCountQueryResponse, { categoryIds: string[] }>(
gql(queries.knowledgeBaseArticlesTotalCount),
{
name: 'articlesCountQuery',
options: ({ currentCategoryId }) => ({
variables: { categoryIds: [currentCategoryId] || [] }
})
}
),
graphql<Props, CategoriesTotalCountQueryResponse>(
gql(queries.knowledgeBaseCategoriesTotalCount),
{
Expand Down

0 comments on commit 077bebf

Please sign in to comment.