Skip to content

Commit

Permalink
Keep track of checked values
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Sep 12, 2020
1 parent 2eac3de commit ae7cc20
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/next/lib/is-serializable-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,16 @@ export function isSerializableProps(
if (Array.isArray(value)) {
visit(refs, value, path)

const seen = new Set<any>()
const newRefs = new Map(refs)
if (
[...new Set(value)].every((nestedValue, index) =>
isSerializable(newRefs, nestedValue, `${path}[${index}]`)
)
value.every((nestedValue, index) => {
if (seen.has(nestedValue)) {
return true
}
seen.add(nestedValue)
return isSerializable(newRefs, nestedValue, `${path}[${index}]`)
})
) {
return true
}
Expand Down

0 comments on commit ae7cc20

Please sign in to comment.