[catalog/queries][s]: optimized the way we query graphql so that we only use single query for dataset/resource pages. It also fixes some buggy behaviour of next.js described in https://github.com/vercel/next.js/issues/8563.
This commit is contained in:
@@ -5,10 +5,10 @@ import { initializeApollo } from '../../../../../lib/apolloClient';
|
||||
import Nav from '../../../../../components/home/Nav';
|
||||
import About from '../../../../../components/resource/About';
|
||||
import DataExplorer from '../../../../../components/resource/DataExplorer';
|
||||
import { GET_RESOURCES_QUERY } from '../../../../../graphql/queries';
|
||||
import { GET_DATASET_QUERY } from '../../../../../graphql/queries';
|
||||
|
||||
const Resource: React.FC<{ variables: any }> = ({ variables }) => {
|
||||
const { data, loading } = useQuery(GET_RESOURCES_QUERY, { variables });
|
||||
const { data, loading } = useQuery(GET_DATASET_QUERY, { variables });
|
||||
|
||||
if (loading) return <div>Loading</div>;
|
||||
const result = data.dataset.result;
|
||||
@@ -42,7 +42,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||
};
|
||||
|
||||
await apolloClient.query({
|
||||
query: GET_RESOURCES_QUERY,
|
||||
query: GET_DATASET_QUERY,
|
||||
variables,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user