Skip to content

Commit

Permalink
Merge pull request #493 from prismicio/aa/fix-shared-slice-typepath-e…
Browse files Browse the repository at this point in the history
…rror

fix: support Shared Slices without primary/items models
  • Loading branch information
angeloashmore authored Jan 11, 2022
2 parents b3a3823 + db83f3d commit fff514d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby-source-prismic/src/runtime/typePaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const sharedSliceModelToTypePaths = <
transformFieldName: TransformFieldNameFn,
): TypePath[] => {
return sharedSliceModel.variations.flatMap((variation) => {
const primary = Object.entries(variation.primary).flatMap(
const primary = Object.entries(variation.primary || {}).flatMap(
([fieldId, fieldModel]) =>
fieldToTypePaths(
[
Expand All @@ -154,7 +154,7 @@ export const sharedSliceModelToTypePaths = <
),
);

const items = Object.entries(variation.items).flatMap(
const items = Object.entries(variation.items || {}).flatMap(
([fieldId, fieldModel]) =>
fieldToTypePaths(
[
Expand Down

0 comments on commit fff514d

Please sign in to comment.