Replies: 10 comments
-
This is intentional. But you can update the defaultValue either by |
Beta Was this translation helpful? Give feedback.
-
We have a scenario where you can choose an entity in a parent route and the form to edit that entity renders in a nested/child route (Outlet). If you change the selected entity, the nested route changes, loader revalidates, the new entity data comes in, and is passed to We have workarounds, like wrapping the Outlet view (form route) in its own component with a |
Beta Was this translation helpful? Give feedback.
-
Maybe your case is a bit unique with a special route hierarchy such that Remix does re-mount the route. What I usually hear is the exact opposite in which people expect the form to reset when they navigate to the same route with a different I don't think this is gonna be helpful as there are many cases it won't work as you expected. There are also implication on how all metadata are derived if we change this behaviour. Maybe you can consider the unique id approach suggested here. |
Beta Was this translation helpful? Give feedback.
-
I might've described it strangely - what you just said is exactly our scenario. 😁
Oooh, yeah that might actually work! We'll try it. |
Beta Was this translation helpful? Give feedback.
-
I am just curious, but I thought you are saying you have a case that works before with v0 and my understanding is that it never works from what I have seen 🤔 |
Beta Was this translation helpful? Give feedback.
-
We tried the data-dependent
Here's the same example using Conform 0.9.1 (it doesn't cache https://stackblitz.com/edit/remix-run-remix-vsjqbc?file=app%2Froutes%2F_index.tsx |
Beta Was this translation helpful? Give feedback.
-
Ah! This only works if you have never change the value on the input. This might be a bug on React because that's the usual expectation with defaultValue: Once the input is mounted, it will never update the value again even default value is changed. |
Beta Was this translation helpful? Give feedback.
-
Ahh, interesting. So my repro might be flawed and perhaps we're doing something else in our real app that made it work in v0.9. Doesn't matter now, I guess. Good catch, though! |
Beta Was this translation helpful? Give feedback.
-
The reset happens in a layout effect so it supposes to run earlier than the effect. But I guess you might have delay it because you are waiting for the updated loaded data and the condition you had on the effect makes it run earlier? I don't have any concern with the |
Beta Was this translation helpful? Give feedback.
-
We'll stick with the |
Beta Was this translation helpful? Give feedback.
-
Describe the bug and the expected behavior
I'm not sure if this is a regression in v1 or if it's now intentional, but in previous versions of Conform leading up to v1, you "fixed" it so
defaultValue
was not cached and thus the form would update when newdefaultValue
was passed in touseForm
(PR #130, released in Conform 0.6.1). Can we get that behavior back? 🙏Conform version
v1.0.2
Steps to Reproduce the Bug or Issue
https://stackblitz.com/edit/remix-run-remix-xq61cg?file=app%2Froutes%2F_index.tsx
What browsers are you seeing the problem on?
No response
Screenshots or Videos
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions