headlessui icon indicating copy to clipboard operation
headlessui copied to clipboard

[DOCS]: Add info about unmount in docs for relationship between Transition and child components

Open spacecat opened this issue 1 year ago • 0 comments

Hi, I'm on version "@headlessui/react": "2.0.0-alpha.3" of HeadlessUI.

I have the following component structure:

<Transition>
   <Dialog>
      <Transition.Child>
         <Transition.Child>

If I set unmount={false} on the root <Transition> component do I have to set it on <Dialog>, <Transition.Child> nr 1, <Transition.Child> nr 2, etc components as well?

If I set it on the root <Transition> component only, then my <Dialog> component's state breaks/gets unmounted.

If I set unmount={false} on the root <Transition> component and all child components then my <Dialog> component's state works - this is a bit unintuitive; you should only need to set it on the root <Transition> component IMO like you do with show.

Thanks!

Update: Collected discussion threads where there's some info:

https://github.com/tailwindlabs/headlessui/issues/44#issuecomment-711170688 https://github.com/tailwindlabs/headlessui/discussions/799 https://github.com/tailwindlabs/headlessui/discussions/800#discussioncomment-1313132 https://github.com/tailwindlabs/headlessui/discussions/1941#discussioncomment-3928532

spacecat avatar Jan 01 '24 17:01 spacecat