0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/.changeset/proxy-free-link-props.md
Brenley Dueck 51b4bd4f37
perf(solid-router): proxy-free link props in the spread hot path (#7609)
useLinkProps stacked four proxies (merge of defaults, two omit proxies,
and a final merge with the resolved-props memo), and Solid's spread()
re-enumerated them through V8 proxy traps on every navigation for every
Link. Return a plain object with a stable key set instead, with
reactivity in property getters backed by fine-grained memos, and add
href-based equality to the built-location memo.

Client-side navigation benchmark: 7.06ms -> 4.80ms per iteration.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-18 03:45:48 +02:00

1.1 KiB

@tanstack/solid-router
patch

perf(solid-router): make useLinkProps proxy-free in the spread hot path

useLinkProps previously layered four proxies (merge for defaults, two splitProps/omit proxies, and a final merge of spreadable props with the resolved props memo). Solid's spread() re-enumerated all of them through V8 proxy traps on every navigation, for every Link, which showed up in CodSpeed profiles as a large unattributed "NodeJS internals" cost.

useLinkProps now returns a plain object with a stable key set whose reactivity lives in property getters backed by fine-grained memos. Values that no longer apply resolve to undefined, which spread() treats as attribute removal. The built-location memo also gained href-based equality so downstream memos skip work when a navigation doesn't change a link's target.

This makes the client-side navigation benchmark ~30% faster.

Note: keys returned by activeProps/inactiveProps functions are discovered once at setup — functions that later return brand-new keys (beyond the initial set plus class/style) won't have those keys applied.