Skip to content

Commit

Permalink
Only check unique values in array
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Sep 12, 2020
1 parent ebaa404 commit 2eac3de
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/next/lib/is-serializable-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,9 @@ export function isSerializableProps(

const newRefs = new Map(refs)
if (
value.every((nestedValue, index) => {
// This prevents interpreting an array which has the same object multiple times as a circular structure
if (value.indexOf(nestedValue) === index) {
return isSerializable(newRefs, nestedValue, `${path}[${index}]`)
} else {
return true
}
})
[...new Set(value)].every((nestedValue, index) =>
isSerializable(newRefs, nestedValue, `${path}[${index}]`)
)
) {
return true
}
Expand Down

0 comments on commit 2eac3de

Please sign in to comment.