Skip to content

Commit

Permalink
fix(source): support Slices without non-repeat/repeat models
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed Nov 6, 2021
1 parent 3643ca4 commit 5821cf0
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 @@ -50,7 +50,7 @@ const fieldToTypePaths = <
}

case prismicT.CustomTypeModelSliceType.Slice: {
const primary = Object.entries(model["non-repeat"]).flatMap(
const primary = Object.entries(model["non-repeat"] || {}).flatMap(
([fieldId, fieldModel]) =>
fieldToTypePaths(
[...path, "primary", transformFieldName(fieldId)],
Expand All @@ -59,7 +59,7 @@ const fieldToTypePaths = <
),
);

const items = Object.entries(model.repeat).flatMap(
const items = Object.entries(model.repeat || {}).flatMap(
([fieldId, fieldModel]) =>
fieldToTypePaths(
[...path, "items", transformFieldName(fieldId)],
Expand Down

0 comments on commit 5821cf0

Please sign in to comment.