Commit eefb1ac6 authored by Janka Uryga's avatar Janka Uryga

[DO NOT MERGE] testing canSegmentBeOverridden

parent 4d3ccd6a
......@@ -1045,5 +1045,6 @@
"1044": "No router instance found.\nYou should only use \"next/router\" on the client side of your app.\n",
"1045": "LRUCache: calculateSize returned %s%s, but size must be > 0. Items with size 0 would never be evicted, causing unbounded cache growth.",
"1046": "`draftMode` must not be used within a Client Component. Next.js should be preventing `draftMode` from being included in Client Components statically, but did not in this case.",
"1047": "Extra keys returned from getStaticPaths in %s (%s) Expected: { paths: [], fallback: boolean }\\nSee here for more info: https://nextjs.org/docs/messages/invalid-getstaticpaths-value"
"1047": "Extra keys returned from getStaticPaths in %s (%s) Expected: { paths: [], fallback: boolean }\\nSee here for more info: https://nextjs.org/docs/messages/invalid-getstaticpaths-value",
"1048": "Woah, canSegmentBeOverridden returned true: %s"
}
......@@ -306,5 +306,11 @@ const canSegmentBeOverridden = (
return false
}
return getSegmentParam(existingSegment)?.paramName === segment[0]
const result = getSegmentParam(existingSegment)?.paramName === segment[0]
if (result) {
throw new Error(
`Woah, canSegmentBeOverridden returned true: ${JSON.stringify({ existingSegment, segment })}`
)
}
return result
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment