You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using kea-forms to handle a form. In particular within this form I have a quantity picker, with buttons to increase and decrease the quantity. In the listeners section I added some instructions to perform after the actions.setFormValue is called. In particular, these are api call, so I do not want to make multiple calls that could provoke side-effects. On the documentation I read about breakpoint and the possibility to use the async breakpoint with a specific amount of ms.
I tried to do as you are suggesting, but it does not seem to work as it should.
Hey @lucaleoni73 , when you say it doesn't work as it should, what happens? The code looks fine to me as it is. I'd still add one more breakpoint() (no await) right after the const response = await ... line, to get rid of "out of order" results, however what you have now should work as a simple 1sec debounce before making the call.
Thais aid, form values can be set with setFormValue, and also with setFormValues, and perhaps even by other actions if they're set up so. If you want to be sure you're not missing anything, I'd suggest using subscriptions to capture all changes to all form values, and then trigger a custom "quantityChanged" action. Then have a listener that listens to it, making various breakpoints even easier to follow.
Hey @mariusandra, thank you for your help. Now it works. Actually, I don't know exactly why it wasn't, cause I follow the docs as it is.
Why should I add the breakpoint() after the await? Shouldn't it be enough?
I'm using kea-forms to handle a form. In particular within this form I have a quantity picker, with buttons to increase and decrease the quantity. In the listeners section I added some instructions to perform after the actions.setFormValue is called. In particular, these are api call, so I do not want to make multiple calls that could provoke side-effects. On the documentation I read about breakpoint and the possibility to use the async breakpoint with a specific amount of ms.
I tried to do as you are suggesting, but it does not seem to work as it should.
Here a piece of my code:
The text was updated successfully, but these errors were encountered: