🏠 back to Observable

Reactive select update out of date

So, I’m having an issue with my notebook which is here:

I’ve been trying to get a better sense about how reactivity works, but can’t seem to find good documentation.

As you can see, as you update the select box on the right, the value updates to the old value of the select box, not the one that fires the onchange notification, Any ideas would be helpful!

Hi @ScatteredRay it seems like your missing the step to trigger the view re-evaluation, you have to sent a custom event e.dispatchEvent(new CustomEvent('input'))

    c.onchange = () => {
      e.value = {state: s.value, county: c.value};
      e.dispatchEvent(new CustomEvent('input'))
    };

you can read more about this on


and more here

Great, that seems to be exactly it. I figured it was somewhere in the documentation that I just missed.

1 Like