[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:
anuveyatsu
2021-08-24 12:15:03 +06:00
parent 6bc36f9e3b
commit feb1fd62f4
6 changed files with 17 additions and 55 deletions

View File

@@ -17,7 +17,7 @@ export const GET_ORG_QUERY = gql`
}
`;
export const GET_DATAPACKAGE_QUERY = gql`
export const GET_DATASET_QUERY = gql`
query dataset($id: String) {
dataset(id: $id) @rest(type: "Response", path: "package_show?{args}") {
result {
@@ -26,23 +26,6 @@ export const GET_DATAPACKAGE_QUERY = gql`
size
created: metadata_created
updated: metadata_modified
resources {
name
id
title
format
size
}
}
}
}
`;
export const GET_RESOURCES_QUERY = gql`
query dataset($id: String) {
dataset(id: $id) @rest(type: "Response", path: "package_show?{args}") {
result {
name
resources {
name
title
@@ -53,6 +36,11 @@ export const GET_RESOURCES_QUERY = gql`
updated: last_modified
size
}
organization {
name
title
image: image_url
}
}
}
}
@@ -132,32 +120,6 @@ export const GET_PAGE_QUERY = gql`
}
`;
export const GET_DATASET_QUERY = gql`
query dataset($id: String) {
dataset(id: $id) @rest(type: "Response", path: "package_show?{args}") {
result {
name
title
size
created: metadata_created
updated: metadata_modified
resources {
name
title
format
created
updated: last_modified
}
organization {
name
title
image: image_url
}
}
}
}
`;
export const GET_POST_QUERY = gql`
query post($slug: String) {
post(slug: $slug)