-
Hello, I have a multi-step modal integrated with a component that collects all data from inputs to create a request payload. I'm facing an issue where the #if tag causes components to unmount, resulting in data loss when changing steps including for the RequestContext. I know I can bind values and store them locally so they're passed to the component when it is remounted, but that doesn't work with the RequestContext, which is very important in my case. Here is a minimal reproduction of the scenario I'm facing: https://svelte.dev/playground/f10844ad20a64904a51945d36f9c2d90?version=latest edit: I want to add that in my real code, RequestContextInput also has validators and states like interacted, isValid, which are reseted when visibility is changed using #if. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you cannot use bindings, I would recommend not using
I do not see how that follows; if you directly bind to the context rather than closing over local component state, there should be no issue - Example |
Beta Was this translation helpful? Give feedback.
Yes.
Regarding the context: It still should be possible to store the actual value on the context separately from the field metadata. But if the CSS approach works for you, that should be fine as well.