From 995a3e5b938b1845b616a8b94c69d948e733205a Mon Sep 17 00:00:00 2001 From: robertu <4065233+robertu7@users.noreply.github.com> Date: Mon, 18 Dec 2023 14:24:51 +0700 Subject: [PATCH] fix(search): remove $version on search queries --- src/components/Search/SearchQuickResult/gql.ts | 12 ++---------- src/components/Search/SearchQuickResult/index.tsx | 5 ----- src/views/Search/AggregateResults/Articles.tsx | 3 +-- src/views/Search/AggregateResults/Tags.tsx | 3 +-- src/views/Search/AggregateResults/Users.tsx | 3 +-- src/views/Search/AggregateResults/gql.ts | 6 ------ src/views/Search/AggregateResults/index.tsx | 7 +++---- 7 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/components/Search/SearchQuickResult/gql.ts b/src/components/Search/SearchQuickResult/gql.ts index 8ce32d6a1f..b3c36832a7 100644 --- a/src/components/Search/SearchQuickResult/gql.ts +++ b/src/components/Search/SearchQuickResult/gql.ts @@ -4,7 +4,7 @@ import { TagDigest } from '~/components/TagDigest' import { UserDigest } from '~/components/UserDigest' export const QUICK_RESULT = gql` - query QuickResult($key: String!, $version: SearchAPIVersion = v20230601) { + query QuickResult($key: String!) { user: search( input: { type: User @@ -12,7 +12,6 @@ export const QUICK_RESULT = gql` record: true first: 5 key: $key - version: $version } ) { edges { @@ -25,14 +24,7 @@ export const QUICK_RESULT = gql` } } tag: search( - input: { - type: Tag - quicksearch: true - record: true - first: 5 - key: $key - version: $version - } + input: { type: Tag, quicksearch: true, record: true, first: 5, key: $key } ) { edges { cursor diff --git a/src/components/Search/SearchQuickResult/index.tsx b/src/components/Search/SearchQuickResult/index.tsx index 19d8d06973..9da2bdd87e 100644 --- a/src/components/Search/SearchQuickResult/index.tsx +++ b/src/components/Search/SearchQuickResult/index.tsx @@ -14,7 +14,6 @@ import { Spinner, TagDigest, UserDigest, - useRoute, } from '~/components' import { QuickResultQuery } from '~/gql/graphql' @@ -31,9 +30,6 @@ interface QuickSearchProps { } export const SearchQuickResult = (props: QuickSearchProps) => { - const { getQuery } = useRoute() - const version = getQuery('version') - const { searchKey, inPage, activeItem, onUpdateData, closeDropdown } = props const client = useApolloClient() const [data, setData] = useState() @@ -76,7 +72,6 @@ export const SearchQuickResult = (props: QuickSearchProps) => { query: QUICK_RESULT, variables: { key: searchKey, - version: version === '' ? undefined : version, }, fetchPolicy: 'no-cache', }) diff --git a/src/views/Search/AggregateResults/Articles.tsx b/src/views/Search/AggregateResults/Articles.tsx index 5a645d83d1..095bb66d9e 100644 --- a/src/views/Search/AggregateResults/Articles.tsx +++ b/src/views/Search/AggregateResults/Articles.tsx @@ -28,7 +28,6 @@ import { SEARCH_AGGREGATE_ARTICLES_PUBLIC } from './gql' const AggregateArticleResults = () => { const { getQuery } = useRoute() const q = getQuery('q') - const version = getQuery('version') /** * Data Fetching @@ -38,7 +37,7 @@ const AggregateArticleResults = () => { usePublicQuery( SEARCH_AGGREGATE_ARTICLES_PUBLIC, { - variables: { key: q, version: version === '' ? undefined : version }, + variables: { key: q }, } ) diff --git a/src/views/Search/AggregateResults/Tags.tsx b/src/views/Search/AggregateResults/Tags.tsx index 909969bcc8..ae3947942c 100644 --- a/src/views/Search/AggregateResults/Tags.tsx +++ b/src/views/Search/AggregateResults/Tags.tsx @@ -24,7 +24,6 @@ import styles from './styles.module.css' const AggregateTagResults = () => { const { getQuery } = useRoute() const q = getQuery('q') - const version = getQuery('version') /** * Data Fetching @@ -33,7 +32,7 @@ const AggregateTagResults = () => { const { data, loading, fetchMore } = usePublicQuery( SEARCH_AGGREGATE_TAGS_PUBLIC, - { variables: { key: q, version: version === '' ? undefined : version } } + { variables: { key: q } } ) useEffect(() => { diff --git a/src/views/Search/AggregateResults/Users.tsx b/src/views/Search/AggregateResults/Users.tsx index 5f1ab01beb..baee1af5f9 100644 --- a/src/views/Search/AggregateResults/Users.tsx +++ b/src/views/Search/AggregateResults/Users.tsx @@ -24,7 +24,6 @@ import styles from './styles.module.css' const AggregateUserResults = () => { const { getQuery } = useRoute() const q = getQuery('q') - const version = getQuery('version') /** * Data Fetching @@ -33,7 +32,7 @@ const AggregateUserResults = () => { const { data, loading, fetchMore } = usePublicQuery( SEARCH_AGGREGATE_USERS_PUBLIC, - { variables: { key: q, version: version === '' ? undefined : version } } + { variables: { key: q } } ) useEffect(() => { diff --git a/src/views/Search/AggregateResults/gql.ts b/src/views/Search/AggregateResults/gql.ts index 9bcd2f21e2..dcb6469a87 100644 --- a/src/views/Search/AggregateResults/gql.ts +++ b/src/views/Search/AggregateResults/gql.ts @@ -7,7 +7,6 @@ export const SEARCH_AGGREGATE_ARTICLES_PUBLIC = gql` $key: String! $first: first_Int_min_0 = 30 $after: String - $version: SearchAPIVersion = v20230601 ) { search( input: { @@ -16,7 +15,6 @@ export const SEARCH_AGGREGATE_ARTICLES_PUBLIC = gql` first: $first key: $key after: $after - version: $version } ) { totalCount @@ -43,7 +41,6 @@ export const SEARCH_AGGREGATE_TAGS_PUBLIC = gql` $key: String! $first: first_Int_min_0 = 30 $after: String - $version: SearchAPIVersion = v20230601 ) { search( input: { @@ -52,7 +49,6 @@ export const SEARCH_AGGREGATE_TAGS_PUBLIC = gql` first: $first key: $key after: $after - version: $version } ) { pageInfo { @@ -78,7 +74,6 @@ export const SEARCH_AGGREGATE_USERS_PUBLIC = gql` $key: String! $first: first_Int_min_0 = 30 $after: String - $version: SearchAPIVersion = v20230601 ) { search( input: { @@ -87,7 +82,6 @@ export const SEARCH_AGGREGATE_USERS_PUBLIC = gql` first: $first key: $key after: $after - version: $version } ) { pageInfo { diff --git a/src/views/Search/AggregateResults/index.tsx b/src/views/Search/AggregateResults/index.tsx index 0afb2629a4..883f231b30 100644 --- a/src/views/Search/AggregateResults/index.tsx +++ b/src/views/Search/AggregateResults/index.tsx @@ -27,7 +27,6 @@ const AggregateResults = () => { getSearchType(getQuery('type')) || Type.ARTICLE ) const q = getQuery('q') - const version = getQuery('version') const isArticle = type === Type.ARTICLE const isUser = type === Type.USER @@ -42,17 +41,17 @@ const AggregateResults = () => { useEffect(() => { client.query({ query: SEARCH_AGGREGATE_ARTICLES_PUBLIC, - variables: { key: q, version: version === '' ? undefined : version }, + variables: { key: q }, fetchPolicy: 'network-only', }) client.query({ query: SEARCH_AGGREGATE_USERS_PUBLIC, - variables: { key: q, version: version === '' ? undefined : version }, + variables: { key: q }, fetchPolicy: 'network-only', }) client.query({ query: SEARCH_AGGREGATE_TAGS_PUBLIC, - variables: { key: q, version: version === '' ? undefined : version }, + variables: { key: q }, fetchPolicy: 'network-only', }) }, [q])