mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Based on: - #73540 --- Currently if you navigate to a partially static route, the server will always start rendering at the first segment that's not present on the previous page. However, it should really start rendering at the first *dynamic* segment — if the client has already prefetched a segment, and it's fully static, there's no reason to render it again during the dynamic server render. We can do this by sending a more specific Next-Router-State-Tree request header. Rather than send a tree that represents the previous route, we sent the tree of the target route, but with a `refetch` marker added to the first dynamic segment. (Without the refetch marker, the server would send back an empty response.) This is determined by diffing against both the previous route *and* the prefetch cache. For now, this only works up to the first dynamic segment inside the new subtree; once the server starts rendering along a path, it renders everything else along that path. We could improve this in the future to also omit static segments that appear inside a dynamic layout, though this would likely require a change to the Next-Router-State-Tree protocol.
13 lines
199 B
TypeScript
13 lines
199 B
TypeScript
export default function StaticLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
return (
|
|
<>
|
|
<div id="static-layout">Static layout</div>
|
|
<div>{children}</div>
|
|
</>
|
|
)
|
|
}
|