Skip to content

Commit

Permalink
chore: update data-explorer-ui to latest (#907) (#3618)
Browse files Browse the repository at this point in the history
Co-authored-by: Fran McDade <franmcdade@Frans-MacBook-Pro.local>
  • Loading branch information
frano-m and Fran McDade authored Aug 15, 2023
1 parent 4e6c993 commit 05cf1de
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
14 changes: 7 additions & 7 deletions explorer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 16 additions & 10 deletions explorer/pages/[entityListType]/[...params].tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -128,22 +131,25 @@ export const getStaticProps: GetStaticProps<AzulEntityStaticResponse> = 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,
Expand Down

0 comments on commit 05cf1de

Please sign in to comment.