[refactor][m]: implement efficient gql management system (#41)

This commit is contained in:
Tavares Hansen
2020-08-03 18:39:17 -07:00
parent cee55cf10d
commit f8197f865c
18 changed files with 201 additions and 310 deletions

View File

@@ -1,30 +1,9 @@
import Link from 'next/link';
import ErrorMessage from '../Error';
import { useQuery } from '@apollo/react-hooks';
import gql from 'graphql-tag';
const QUERY = gql`
query dataset($id: String) {
dataset(id: $id) @rest(type: "Response", path: "package_show?{args}") {
result {
resources {
name
id
title
description
format
size
created
last_modified
url
}
}
}
}
`;
import ErrorMessage from '../Error';
import { GET_RESOURCES_QUERY } from '../../graphql/queries';
export default function DataExplorer({ variables }) {
const { loading, error, data } = useQuery(QUERY, {
const { loading, error, data } = useQuery(GET_RESOURCES_QUERY, {
variables,
// Setting this value to true will make the component rerender when
// the "networkStatus" changes, so we are able to know if it is fetching