diff --git a/compiler/apps/playground/components/Editor/EditorImpl.tsx b/compiler/apps/playground/components/Editor/EditorImpl.tsx index 9f000f85564a2..e7068534cd0cb 100644 --- a/compiler/apps/playground/components/Editor/EditorImpl.tsx +++ b/compiler/apps/playground/components/Editor/EditorImpl.tsx @@ -24,7 +24,11 @@ import BabelPluginReactCompiler, { printFunctionWithOutlined, type LoggerEvent, } from 'babel-plugin-react-compiler'; -import {useDeferredValue, useMemo} from 'react'; +import { + useDeferredValue, + useMemo, + unstable_ViewTransition as ViewTransition, +} from 'react'; import {useStore} from '../StoreContext'; import ConfigEditor from './ConfigEditor'; import Input from './Input'; diff --git a/compiler/apps/playground/components/TabbedWindow.tsx b/compiler/apps/playground/components/TabbedWindow.tsx index 1fd5f188c7de1..c324e3ce4505a 100644 --- a/compiler/apps/playground/components/TabbedWindow.tsx +++ b/compiler/apps/playground/components/TabbedWindow.tsx @@ -4,8 +4,14 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -import React from 'react'; +import React, { + startTransition, + useId, + unstable_ViewTransition as ViewTransition, + unstable_addTransitionType as addTransitionType, +} from 'react'; import clsx from 'clsx'; +import {TOGGLE_TAB_TRANSITION} from '../lib/transitionTypes'; export default function TabbedWindow({ tabs, @@ -16,6 +22,16 @@ export default function TabbedWindow({ activeTab: string; onTabChange: (tab: string) => void; }): React.ReactElement { + const id = useId(); + const transitionName = `tab-highlight-${id}`; + + const handleTabChange = (tab: string): void => { + startTransition(() => { + addTransitionType(TOGGLE_TAB_TRANSITION); + onTabChange(tab); + }); + }; + return (