RadixUI/Shadcn unexpected Portal behaviour (does not reset state)

141 Views Asked by At

I'm using RadixUI Dialog (https://www.radix-ui.com/primitives/docs/components/dialog) and I want to completely reset its state on closing. Here is a working example where I moved the its content to separate component which define input state: https://codesandbox.io/p/devbox/pedantic-hellman-4k565n?file=%2FApp.jsx%3A17%2C27

Try to open modal, set some content to input and close it. Then try to open it again and input is correctly empty so it reset entirely. HOWEVER, when I move Dialog.DialogPortal to ButtonDialogContent component, the state does not reset at all and when reopening, the old vallue is shown. Why does it happen?

0

There are 0 best solutions below