diff --git a/app/browser/dataset-preview.tsx b/app/browser/dataset-preview.tsx index 443235200..5e3de4da0 100644 --- a/app/browser/dataset-preview.tsx +++ b/app/browser/dataset-preview.tsx @@ -115,7 +115,10 @@ export const DataSetPreview = ({ sourceType: dataSource.type, sourceUrl: dataSource.url, locale, - cubeFilters, + cubeFilters: cubeFilters.map((filter) => ({ + ...filter, + disableValuesLoad: true, + })), }, }); const classes = useStyles({ diff --git a/app/graphql/query-hooks.ts b/app/graphql/query-hooks.ts index 436d9a706..4cee87749 100644 --- a/app/graphql/query-hooks.ts +++ b/app/graphql/query-hooks.ts @@ -99,6 +99,7 @@ export type DataCubeComponentFilter = { filters?: Maybe; componentIris?: Maybe>; joinBy?: Maybe; + disableValuesLoad?: Maybe; }; diff --git a/app/graphql/resolver-types.ts b/app/graphql/resolver-types.ts index 1d11d17da..0ede52412 100644 --- a/app/graphql/resolver-types.ts +++ b/app/graphql/resolver-types.ts @@ -100,6 +100,7 @@ export type DataCubeComponentFilter = { filters?: Maybe; componentIris?: Maybe>; joinBy?: Maybe; + disableValuesLoad?: Maybe; }; diff --git a/app/graphql/resolvers/rdf.ts b/app/graphql/resolvers/rdf.ts index d59c72a5a..d1489857b 100644 --- a/app/graphql/resolvers/rdf.ts +++ b/app/graphql/resolvers/rdf.ts @@ -152,7 +152,13 @@ export const dataCubeComponents: NonNullable< const { loaders, sparqlClient, sparqlClientStream, cache } = await setup( info ); - const { iri, latest = true, componentIris, filters } = cubeFilter; + const { + iri, + latest = true, + componentIris, + filters, + disableValuesLoad, + } = cubeFilter; const rawCube = await loaders.cube.load(iri); if (!rawCube) { @@ -176,21 +182,27 @@ export const dataCubeComponents: NonNullable< await Promise.all( rawComponents.map(async (component) => { const { data } = component; - const dimensionValuesLoader = getDimensionValuesLoader( - sparqlClient, - loaders, - cache, - filters - ); - const values: DimensionValue[] = await dimensionValuesLoader.load( - component - ); - values.sort((a, b) => - ascending( - a.position ?? a.value ?? undefined, - b.position ?? b.value ?? undefined - ) - ); + + let values: DimensionValue[] = []; + + if (!disableValuesLoad) { + const dimensionValuesLoader = getDimensionValuesLoader( + sparqlClient, + loaders, + cache, + filters + ); + const values: DimensionValue[] = await dimensionValuesLoader.load( + component + ); + values.sort((a, b) => + ascending( + a.position ?? a.value ?? undefined, + b.position ?? b.value ?? undefined + ) + ); + } + const baseComponent: BaseComponent = { // We need to use original iri here, as the cube iri might have changed. cubeIri: iri, @@ -220,7 +232,7 @@ export const dataCubeComponents: NonNullable< measures.push(result); } else { const dimensionType = resolveDimensionType(component); - const hierarchy = true // TODO: make this configurable + const hierarchy = !disableValuesLoad ? await queryHierarchy( component, locale, diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index e8948abb9..f8436e046 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -344,6 +344,7 @@ input DataCubeComponentFilter { filters: Filters componentIris: [String!] joinBy: String + disableValuesLoad: Boolean } input DataCubeMetadataFilter {