Can conform work with a virtualized list of inputs? #1007
-
Imagine a form where a dynamic number of inputs are part of a paginated or virtualized list. It seems that, whether each input is controlled or uncontrolled, I can't help losing the changes made to the input once they are unmounted (ie when unloading a chunk upon scrolling or going to the next page). Is there a way to make such a form work in Conform? Cheers, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Conform does not maintain values internally and relies on the DOM. For this kind of usage, I would recommend using a controlled input: keep the value in React state and validate against that state instead. Relying on FormData will not work when the inputs are not actually rendered. The alternative would be to render hidden inputs for those values, but that mostly defeats the purpose of using a virtualized list. |
Beta Was this translation helpful? Give feedback.
Conform does not maintain values internally and relies on the DOM.
For this kind of usage, I would recommend using a controlled input: keep the value in React state and validate against that state instead. Relying on FormData will not work when the inputs are not actually rendered. The alternative would be to render hidden inputs for those values, but that mostly defeats the purpose of using a virtualized list.