Skip to content

Commit

Permalink
Merge pull request #4099 from thematters/fix/prod-search-version
Browse files Browse the repository at this point in the history
fix(search): remove $version on search queries
  • Loading branch information
robertu7 authored Dec 18, 2023
2 parents 3172ec4 + 995a3e5 commit ce1ebe5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 31 deletions.
12 changes: 2 additions & 10 deletions src/components/Search/SearchQuickResult/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ 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
quicksearch: true
record: true
first: 5
key: $key
version: $version
}
) {
edges {
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/components/Search/SearchQuickResult/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
Spinner,
TagDigest,
UserDigest,
useRoute,
} from '~/components'
import { QuickResultQuery } from '~/gql/graphql'

Expand All @@ -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<QuickResultQuery>()
Expand Down Expand Up @@ -76,7 +72,6 @@ export const SearchQuickResult = (props: QuickSearchProps) => {
query: QUICK_RESULT,
variables: {
key: searchKey,
version: version === '' ? undefined : version,
},
fetchPolicy: 'no-cache',
})
Expand Down
3 changes: 1 addition & 2 deletions src/views/Search/AggregateResults/Articles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -38,7 +37,7 @@ const AggregateArticleResults = () => {
usePublicQuery<SearchAggregateArticlesPublicQuery>(
SEARCH_AGGREGATE_ARTICLES_PUBLIC,
{
variables: { key: q, version: version === '' ? undefined : version },
variables: { key: q },
}
)

Expand Down
3 changes: 1 addition & 2 deletions src/views/Search/AggregateResults/Tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,7 +32,7 @@ const AggregateTagResults = () => {
const { data, loading, fetchMore } =
usePublicQuery<SearchAggregateTagsPublicQuery>(
SEARCH_AGGREGATE_TAGS_PUBLIC,
{ variables: { key: q, version: version === '' ? undefined : version } }
{ variables: { key: q } }
)

useEffect(() => {
Expand Down
3 changes: 1 addition & 2 deletions src/views/Search/AggregateResults/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,7 +32,7 @@ const AggregateUserResults = () => {
const { data, loading, fetchMore } =
usePublicQuery<SearchAggregateUsersPublicQuery>(
SEARCH_AGGREGATE_USERS_PUBLIC,
{ variables: { key: q, version: version === '' ? undefined : version } }
{ variables: { key: q } }
)

useEffect(() => {
Expand Down
6 changes: 0 additions & 6 deletions src/views/Search/AggregateResults/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -16,7 +15,6 @@ export const SEARCH_AGGREGATE_ARTICLES_PUBLIC = gql`
first: $first
key: $key
after: $after
version: $version
}
) {
totalCount
Expand All @@ -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: {
Expand All @@ -52,7 +49,6 @@ export const SEARCH_AGGREGATE_TAGS_PUBLIC = gql`
first: $first
key: $key
after: $after
version: $version
}
) {
pageInfo {
Expand All @@ -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: {
Expand All @@ -87,7 +82,6 @@ export const SEARCH_AGGREGATE_USERS_PUBLIC = gql`
first: $first
key: $key
after: $after
version: $version
}
) {
pageInfo {
Expand Down
7 changes: 3 additions & 4 deletions src/views/Search/AggregateResults/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
Expand Down

0 comments on commit ce1ebe5

Please sign in to comment.