Skip to content

Commit 05cf1de

Browse files
frano-mFran McDade
and
Fran McDade
authored
chore: update data-explorer-ui to latest (#907) (#3618)
Co-authored-by: Fran McDade <[email protected]>
1 parent 4e6c993 commit 05cf1de

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

explorer/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

explorer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"test:anvil-catalog": "playwright test -c playwright_anvil-catalog.config.ts"
3434
},
3535
"dependencies": {
36-
"@clevercanary/data-explorer-ui": "0.35.0",
36+
"@clevercanary/data-explorer-ui": "0.37.0",
3737
"@emotion/react": "11.11.1",
3838
"@emotion/styled": "11.11.0",
3939
"@mdx-js/loader": "^2.3.0",

explorer/pages/[entityListType]/[...params].tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { AzulEntityStaticResponse } from "@clevercanary/data-explorer-ui/lib/apis/azul/common/entities";
2-
import { PARAMS_INDEX_UUID } from "@clevercanary/data-explorer-ui/lib/common/constants";
2+
import {
3+
PARAMS_INDEX_TAB,
4+
PARAMS_INDEX_UUID,
5+
} from "@clevercanary/data-explorer-ui/lib/common/constants";
36
import { EntityConfig } from "@clevercanary/data-explorer-ui/lib/config/entities";
47
import { getEntityConfig } from "@clevercanary/data-explorer-ui/lib/config/utils";
58
import { getEntityService } from "@clevercanary/data-explorer-ui/lib/hooks/useEntityService";
@@ -128,22 +131,25 @@ export const getStaticProps: GetStaticProps<AzulEntityStaticResponse> = async ({
128131
}
129132

130133
const props: EntityDetailPageProps = { entityListType: entityListType };
134+
135+
// If the entity detail view is to be "statically loaded", we need to seed the database (for retrieval of the entity), or
136+
// fetch the entity detail from API.
131137
if (entityConfig.detail.staticLoad) {
132138
// Seed database.
133-
if (
134-
entityConfig &&
135-
entityConfig.staticLoad &&
136-
entityConfig.detail.staticLoad
137-
) {
139+
if (entityConfig.staticLoad) {
138140
await seedDatabase(entityConfig.route, entityConfig);
139141
}
140-
142+
// Grab the entity detail, either from database or API.
141143
const { fetchEntityDetail, path } = getEntityService(entityConfig);
142-
const data = await fetchEntityDetail(
144+
// When the entity detail is to be fetched from API, we only do so for the first tab.
145+
if (!entityConfig.staticLoad && params?.params?.[PARAMS_INDEX_TAB]) {
146+
return { props };
147+
}
148+
props.data = await fetchEntityDetail(
143149
(params as PageUrl).params[PARAMS_INDEX_UUID],
144-
path
150+
path,
151+
undefined
145152
);
146-
props.data = data;
147153
}
148154
return {
149155
props,

0 commit comments

Comments
 (0)