Skip to content

Commit

Permalink
fix: fix seeding database for client-side data (#3798)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran McDade authored and Fran McDade committed Nov 28, 2023
1 parent 3f23758 commit 0c560b9
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 0c560b9

Please sign in to comment.