Reactivity and setValue(...) triggering even without a change

Hi together,

i have noticed that all queries, transformers, and so on are always triggered by their input-values, even if the input-values didn't change.

Is there a way to prevent the dependency-chain to fire, when a value hadn't changed?


Pretty easy example to recreate this:

  • transformer1 depends on numberInput1, but only changes its return value on the transition from 6 to 7 of numberInput1 (and vice-versa)
  • query1 uses the value of of transformer1 in a WHERE clause
  • changing the value of numberInput1 triggers transformer1, which will not change its output, BUT triggers query1 again, leading to an unwanted refresh

Is there any way i can prevent this behaviour?

Best regards!

Query1 will be triggered unless you are caching the results:
Screenshot 2025-02-03 at 11.48.13 AM

That being said, make sure that the event you are using to return the transformer value from the numberInput1 is being done onChange or another event and/or check to make sure that you may or may not need to debounce that event.

1 Like

Hey there @flaschenpost-wha,

Yeah, that is indeed an unwanted refresh and unnecessary use of resources... From the top of my head, a workaround I can think of:

  • create a variable called transformerResult
  • replace your transformer with a js query where
    1. you make your calculation
    2. check if the value of the variable is equal to the result of the calculation
    3. if it isn't then trigger query1.
    4. Finally set variable with the result of the calculation
  • set up an event handler in your numberInput1 to trigger the JS on change
  • change run behaviour of query1 as manual rather than automatic (although this may not be possible depending on your use case, if so then this post is kind of useless)
1 Like