Skip to content

Commit

Permalink
fix: fix seeding database for client-side data (#3798) (#3799)
Browse files Browse the repository at this point in the history
Co-authored-by: Fran McDade <[email protected]>
  • Loading branch information
frano-m and Fran McDade authored Nov 28, 2023
1 parent 3f23758 commit b8d9289
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions explorer/pages/[entityListType]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const seedDatabase = async function seedDatabase( // TODO get rid of this duplic
entityListType: string,
entityConfig: EntityConfig
): Promise<void> {
const { entityMapper, label, staticLoadFile } = entityConfig;
const { label, staticLoadFile } = entityConfig;

if (!staticLoadFile) {
throw new Error(`staticLoadFile not found for entity entity ${label}`);
Expand All @@ -42,9 +42,7 @@ const seedDatabase = async function seedDatabase( // TODO get rid of this duplic
}

const object = JSON.parse(rawData.toString());
const entities = entityMapper
? Object.values(object).map(entityMapper)
: Object.values(object);
const entities = Object.values(object); // Client-side fetched entities are mapped prior to dispatch to explore state.

// Seed entities.
database.get().seed(entityListType, entities);
Expand Down

0 comments on commit b8d9289

Please sign in to comment.