Files
Andrew ClarkandGitHub 6611813e03 Fix: Subtree hints not propagating correctly (#94489)
Fixes a mistake in the client when constructing a route tree from a
partial server response. When applying the patch, we must propagate the
new subtree hints all the way up to the root.

This was an existing bug that I found when implementing the next PR in
the stack, which relies on the subtree hint mechanism. I've split it out
into its own step and confirmed the bug + fix using a regression test
expressed via existing behavior.

<!-- NEXT_JS_LLM_PR -->
2026-06-07 21:33:09 -07:00

34 lines
668 B
TypeScript

'use client'
import Link, { type LinkProps } from 'next/link'
import { useState } from 'react'
export function LinkAccordion({
href,
children,
prefetch,
}: {
href: LinkProps['href']
children: React.ReactNode
prefetch?: LinkProps['prefetch']
}) {
const [isVisible, setIsVisible] = useState(false)
return (
<>
<input
type="checkbox"
checked={isVisible}
onChange={() => setIsVisible(!isVisible)}
data-link-accordion={href}
/>
{isVisible ? (
<Link href={href} prefetch={prefetch}>
{children}
</Link>
) : (
`${children} (link is hidden)`
)}
</>
)
}