Fork me on GitHub
#fulcro
<
2022-12-01
>
Eva O13:12:31

How do you debounce form input change in RAD? I'm trying to check if the field value is present in the server so I can show a client-side error message on duplicates. I'm currently doing this with an on-change trigger that loads the server value on every keystroke. I'm not sure if it creates too many calls to the server if the person is typing fast. I would like to debounce the server loads if possible

tony.kay18:12:23

you could create a debounced function to use within the on-change trigger

tony.kay18:12:42

or you could modify the state machine that is used with your form and customize it however you want

tony.kay18:12:14

on change is called on form/input-changed! which MOST of the built-in controls ONLY call on blur

tony.kay18:12:28

so are you using a custom control of your own?

tony.kay18:12:22

The way I would do the thing you are asking is as follows: • I’d create a custom renderer for that field type (with a new style) • Install that new control • Set that form to use that style for that field • Localize the server I/O to the internals of that new form field renderer

👀 1
tony.kay18:12:43

Use hooks to localize the query tree and such to that renderer