From 56c4d523da3ec6809e08c59927ac57db14f98022 Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 5 Nov 2026 18:25:11 +0300 Subject: [PATCH] Fix broken examples and code highlighting in ViewTransition and addTransitionType The fixed example in "two components" still passes item={item} while Item reads {id}, so every item is named "item-undefined" and triggers the same error. The first addTransitionType example has a syntax error ({action)) and a fence without a language, so its CodeSteps never render. Line highlights written as [3, 5] / [3] / [11] are ignored by getHighlightLines, which only reads {...}; switch them to braces and update ranges that no longer match the code. Also use checked instead of value on the "Fast" checkbox, move key to the outer element in the wrapper snippet, drop the nonexistent `layout` prop from addTransitionType, and remove a "sidebar" reference from the Activity example, which only has a counter. --- src/content/reference/react/ViewTransition.md | 22 +++++++++---------- .../reference/react/addTransitionType.md | 8 +++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/content/reference/react/ViewTransition.md b/src/content/reference/react/ViewTransition.md index 17595bb763e..d754d08b801 100644 --- a/src/content/reference/react/ViewTransition.md +++ b/src/content/reference/react/ViewTransition.md @@ -442,7 +442,7 @@ button:hover { If there's a `
` above ``, no exit/enter animations trigger: -```js [3, 5] +```js {3,7} function Item() { return (
{/* 🚩
above breaks exit/enter */} @@ -473,7 +473,7 @@ If you want to animate a component in and out while preserving its state, or pre ``` -In this example, `Counter` has a counter with internal state. Try incrementing the counter, hiding it, then showing it again. The counter's value is preserved while the sidebar animates in and out: +In this example, `Counter` has a counter with internal state. Try incrementing the counter, hiding it, then showing it again. The counter's value is preserved while `Counter` animates in and out: @@ -574,7 +574,7 @@ function Counter() { -Without ``, the counter would reset to `0` every time the sidebar reappears. +Without ``, the counter would reset to `0` every time it reappears. --- @@ -1235,8 +1235,8 @@ button:hover { This means you might want to avoid wrapper elements in lists where you want to allow the Component to control its own reorder animation: -``` -items.map(item =>
) +```js +items.map(item =>
) ``` The above rule also applies if one of the items updates to resize, which then causes the siblings to resize, it'll also animate its sibling `` but only if they're immediate siblings. @@ -2630,7 +2630,7 @@ export default function Component() { return ( <>
- Fast: {setIsFast(f => !f)}} value={isFast}> + Fast: {setIsFast(f => !f)}} checked={isFast}>