T
TanStack•4w ago
afraid-scarlet

Form does not use initial values from async query result

3 Replies
metropolitan-bronze
metropolitan-bronze•4w ago
that defaultState seems to not be correct. You would only need to rely on defaultValues in this case does the error continue to happen if you remove that?
afraid-scarlet
afraid-scarletOP•4w ago
it seems the rendering is wrong but when submitting instantly I get the expected values 🤔 Maybe <div>{JSON.stringify(form.state.values)}</div> just doesn't work? Because this works 🙂
<div>
{Object.entries(form.state.values).map(([fieldID, value]) => (
<div key={fieldID}>
{fieldID} - {Array.isArray(value) ? value.join(", ") : String(value)}
</div>
))}
</div>
<div>
{Object.entries(form.state.values).map(([fieldID, value]) => (
<div key={fieldID}>
{fieldID} - {Array.isArray(value) ? value.join(", ") : String(value)}
</div>
))}
</div>
metropolitan-bronze
metropolitan-bronze•4w ago
oh, you should check the Reactivity section of Basic Concepts the form variable is stable, so if you want to listen to props you need a hook or the subscribe element

Did you find this page helpful?