Commit d7a94319 authored by Zack Tanner's avatar Zack Tanner

failing test for circular references

parent 22cc5be0
'use client'
export default function ClientComp({ data }: { data: { title: string } }) {
return (
<pre>
<div>Hello World</div>
{data.title}
</pre>
)
}
import { ReactNode } from 'react'
export default function Root({ children }: { children: ReactNode }) {
return (
<html>
<body>{children}</body>
</html>
)
}
import Link from 'next/link'
export default function Page() {
return (
<p>
other page <Link href="/">home</Link>
</p>
)
}
import ClientComp from './client'
export default async function Page() {
const topic = { title: 'Topic', fields: { featured: [] } }
const guide = { title: 'Guide', fields: { topic: [topic] } }
const featured = {
title: 'Featured',
fields: {
content: [guide],
topic, // points back to the same topic
},
}
// Circular reference: topic -> featured[] -> content[] -> topic
topic.fields.featured.push(featured)
return (
<div>
<ClientComp data={topic} />
Other
</div>
)
}
import { nextTestSetup } from 'e2e-utils'
describe('circular-reference-client-component', () => {
const { next } = nextTestSetup({
files: __dirname,
env: {
NEXT_DEBUG_BUILD: '1',
},
})
it('should not have errors when collecting segment data for a page with a circular reference to a client component', async () => {
expect(next.cliOutput).not.toContain(
'Error: Route / errored during segment collection'
)
})
})
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {}
module.exports = nextConfig
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