[recent datasets][xs]: only need first 3 datasets.
This commit is contained in:
parent
19f1d4b408
commit
5e62325c91
@ -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
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -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 (
|
||||
<div className="container mx-auto">
|
||||
<Head>
|
||||
@ -42,6 +42,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||
query: QUERY,
|
||||
variables: {
|
||||
sort: 'metadata_created desc',
|
||||
rows: 3,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user