diff --git a/explorer/package-lock.json b/explorer/package-lock.json index 5b7dd6943..32bf860f8 100644 --- a/explorer/package-lock.json +++ b/explorer/package-lock.json @@ -8,7 +8,7 @@ "name": "explorer", "version": "0.1.0", "dependencies": { - "@clevercanary/data-explorer-ui": "0.35.0", + "@clevercanary/data-explorer-ui": "0.37.0", "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", "@mdx-js/loader": "^2.3.0", @@ -2119,9 +2119,9 @@ "dev": true }, "node_modules/@clevercanary/data-explorer-ui": { - "version": "0.35.0", - "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.35.0.tgz", - "integrity": "sha512-GvvRQrsvQ6JsV+uweEMeqdEoLMUIZ1MZqjb/JF/3J2oOpVnifrecD3x0eSQ2cYqDz4u0ZF6ajOUNSsyjs/ZFmg==", + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.37.0.tgz", + "integrity": "sha512-HlWkCkmRJRnRmvc6Qa4n5MwOJ9cbYVJ7gznP1O2SJcW/cTpPkSAN/S+VmXDEFRVsBw5V7PSQAdEPHSgG2TI88Q==", "peerDependencies": { "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", @@ -25187,9 +25187,9 @@ "dev": true }, "@clevercanary/data-explorer-ui": { - "version": "0.35.0", - "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.35.0.tgz", - "integrity": "sha512-GvvRQrsvQ6JsV+uweEMeqdEoLMUIZ1MZqjb/JF/3J2oOpVnifrecD3x0eSQ2cYqDz4u0ZF6ajOUNSsyjs/ZFmg==", + "version": "0.37.0", + "resolved": "https://registry.npmjs.org/@clevercanary/data-explorer-ui/-/data-explorer-ui-0.37.0.tgz", + "integrity": "sha512-HlWkCkmRJRnRmvc6Qa4n5MwOJ9cbYVJ7gznP1O2SJcW/cTpPkSAN/S+VmXDEFRVsBw5V7PSQAdEPHSgG2TI88Q==", "requires": {} }, "@colors/colors": { diff --git a/explorer/package.json b/explorer/package.json index 8922e5d6e..a2898204c 100644 --- a/explorer/package.json +++ b/explorer/package.json @@ -33,7 +33,7 @@ "test:anvil-catalog": "playwright test -c playwright_anvil-catalog.config.ts" }, "dependencies": { - "@clevercanary/data-explorer-ui": "0.35.0", + "@clevercanary/data-explorer-ui": "0.37.0", "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", "@mdx-js/loader": "^2.3.0", diff --git a/explorer/pages/[entityListType]/[...params].tsx b/explorer/pages/[entityListType]/[...params].tsx index 228e9d31c..a97b7f39a 100644 --- a/explorer/pages/[entityListType]/[...params].tsx +++ b/explorer/pages/[entityListType]/[...params].tsx @@ -1,5 +1,8 @@ import { AzulEntityStaticResponse } from "@clevercanary/data-explorer-ui/lib/apis/azul/common/entities"; -import { PARAMS_INDEX_UUID } from "@clevercanary/data-explorer-ui/lib/common/constants"; +import { + PARAMS_INDEX_TAB, + PARAMS_INDEX_UUID, +} from "@clevercanary/data-explorer-ui/lib/common/constants"; import { EntityConfig } from "@clevercanary/data-explorer-ui/lib/config/entities"; import { getEntityConfig } from "@clevercanary/data-explorer-ui/lib/config/utils"; import { getEntityService } from "@clevercanary/data-explorer-ui/lib/hooks/useEntityService"; @@ -128,22 +131,25 @@ export const getStaticProps: GetStaticProps = async ({ } const props: EntityDetailPageProps = { entityListType: entityListType }; + + // If the entity detail view is to be "statically loaded", we need to seed the database (for retrieval of the entity), or + // fetch the entity detail from API. if (entityConfig.detail.staticLoad) { // Seed database. - if ( - entityConfig && - entityConfig.staticLoad && - entityConfig.detail.staticLoad - ) { + if (entityConfig.staticLoad) { await seedDatabase(entityConfig.route, entityConfig); } - + // Grab the entity detail, either from database or API. const { fetchEntityDetail, path } = getEntityService(entityConfig); - const data = await fetchEntityDetail( + // When the entity detail is to be fetched from API, we only do so for the first tab. + if (!entityConfig.staticLoad && params?.params?.[PARAMS_INDEX_TAB]) { + return { props }; + } + props.data = await fetchEntityDetail( (params as PageUrl).params[PARAMS_INDEX_UUID], - path + path, + undefined ); - props.data = data; } return { props,