noahsalvi / svelte-use-form

The most compact reactive form controller (including Validation) that you'll ever see.
MIT License
252 stars 14 forks source link

How to handle async data #25

Closed conoroshea1996 closed 2 years ago

conoroshea1996 commented 2 years ago

Hey awesome library. Im wondering if theres a way to handle this as I can't see anything in the demo's sorry if its there. Im fetching data from an api and populating the fields with that data. An issue Im running into is because the data is not set instantly. It does not update the values in the form making them invalid so for example here the name should have the company name value

Capture

Is there a way to force an update after fetching from the Api

noahsalvi commented 2 years ago

thank you!

no worries, It's probably still missing from the examples Here are some suggestions (You don't need to read the whole thread only the subtitles below "Solutions for the internal state not being updated)

conoroshea1996 commented 2 years ago

Cheers thanks for the response I'll have have a play around and see if somethings works I'll close this issue