diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index 152ea70..da29474 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improve `Menu` component performance ([#3685](https://github.com/tailwindlabs/headlessui/pull/3685)) - Improve `Listbox` component performance ([#3688](https://github.com/tailwindlabs/headlessui/pull/3688)) - Open `Menu` and `Listbox` on `mousedown` ([#3689](https://github.com/tailwindlabs/headlessui/pull/3689)) +- Fix `Transition` component from incorrectly exposing the `Closing` state ([#3696](https://github.com/tailwindlabs/headlessui/pull/3696)) ## [2.2.1] - 2025-04-04 diff --git a/packages/@headlessui-react/src/components/transition/transition.tsx b/packages/@headlessui-react/src/components/transition/transition.tsx index 930f318..3832529 100644 --- a/packages/@headlessui-react/src/components/transition/transition.tsx +++ b/packages/@headlessui-react/src/components/transition/transition.tsx @@ -330,7 +330,7 @@ function TransitionChildFn unregister(container), [TreeStates.Visible]: () => register(container), }) - }, [state, container, register, unregister, show, strategy]) + }, [treeState, container, register, unregister, show, strategy]) let ready = useServerHandoffComplete() useIsoMorphicEffect(() => { if (!requiresRef) return - if (ready && state === TreeStates.Visible && container.current === null) { + if (ready && treeState === TreeStates.Visible && container.current === null) { throw new Error('Did you forget to passthrough the `ref` to the actual DOM node?') } - }, [container, state, ready, requiresRef]) + }, [container, treeState, ready, requiresRef]) // Skipping initial transition let skip = initial && !appear @@ -470,10 +470,10 @@ function TransitionChildFn