Fix double beforeEnter due to SSR (#1183)

* prevent initial transitioning in SSR environment

Due to SSR and the hydration step, the transition code was already
called even if we were not ready yet. This caused an issue where the
`beforeEnter` callback got fired twice intead of once.

Fixes: #311

* update changelog
This commit is contained in:
Robin Malfait
2022-03-02 16:30:17 +01:00
committed by GitHub
parent 67995b6961
commit 8e7478d1d2
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve outside click support ([#1175](https://github.com/tailwindlabs/headlessui/pull/1175))
- Ensure that `appear` works regardless of multiple rerenders ([#1179](https://github.com/tailwindlabs/headlessui/pull/1179))
- Reset Combobox Input when the value gets reset ([#1181](https://github.com/tailwindlabs/headlessui/pull/1181))
- Fix double `beforeEnter` due to SSR ([#1183](https://github.com/tailwindlabs/headlessui/pull/1183))
## [Unreleased - @headlessui/vue]
@@ -279,6 +279,7 @@ let TransitionChild = forwardRefWithAs(function TransitionChild<
useIsoMorphicEffect(() => {
let node = container.current
if (!node) return
if (!ready) return
if (skip) return
if (show === prevShow.current) return
@@ -328,6 +329,7 @@ let TransitionChild = forwardRefWithAs(function TransitionChild<
container,
skip,
show,
ready,
enterClasses,
enterFromClasses,
enterToClasses,