Unverified Commit 558632b5 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Avoid server insertion react key warning (#51053)

Wrap server inseration children with react key to avoid react key
warning display
parent 4080f635
......@@ -1458,8 +1458,12 @@ export async function renderToHTMLOrFlight(
ReactDOMServer: require('react-dom/server.edge'),
element: (
<>
{Array.from(serverInsertedHTMLCallbacks).map((callback) =>
callback()
{Array.from(serverInsertedHTMLCallbacks).map(
(callback, index) => (
<React.Fragment key={'_next_insert' + index}>
{callback()}
</React.Fragment>
)
)}
{polyfillsFlushed
? null
......
......@@ -117,6 +117,9 @@ createNextDescribe(
internalQueries.some((query) => content.includes(query))
)
expect(hasNextInternalQuery).toBe(false)
expect(next.cliOutput).not.toContain(
'Each child in a list should have a unique "key" prop'
)
})
it('should reuse the inline flight response without sending extra requests', async () => {
......
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