diff --git a/components/home/Recent.tsx b/components/home/Recent.tsx index bc3937f1..910b7ec6 100644 --- a/components/home/Recent.tsx +++ b/components/home/Recent.tsx @@ -4,8 +4,8 @@ import { useQuery } from '@apollo/react-hooks'; import gql from 'graphql-tag'; export const QUERY = gql` - query search($q: String, $sort: String) { - search(q: $q, sort: $sort) + query search($q: String, $sort: String, $rows: Int) { + search(q: $q, sort: $sort, rows: $rows) @rest(type: "Search", path: "package_search?{args}") { result { results { @@ -24,7 +24,10 @@ export const QUERY = gql` function Recent() { const { loading, error, data } = useQuery(QUERY, { - variables: { sort: 'metadata_created desc' }, + variables: { + sort: 'metadata_created desc', + rows: 3, + }, // Setting this value to true will make the component rerender when // the "networkStatus" changes, so we are able to know if it is fetching // more data diff --git a/mocks/index.js b/mocks/index.js index ff42cde6..f9939fae 100644 --- a/mocks/index.js +++ b/mocks/index.js @@ -91,7 +91,7 @@ module.exports.initMocks = function () { }, }) // 3. Call for recent packages. - .get('/package_search?sort=metadata_created%20desc') + .get('/package_search?sort=metadata_created%20desc&rows=3') .reply(200, { success: true, result: { diff --git a/pages/index.tsx b/pages/index.tsx index dfb9c05c..86507a1d 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -5,7 +5,7 @@ import Nav from '../components/home/Nav'; import Recent, { QUERY } from '../components/home/Recent'; import Form from '../components/search/Form'; -function Home({ datapackages }) { +function Home() { return (