Closed TimChild closed 7 months ago
In Dash, callbacks are triggered on property changes, which is why e.g. button clicks are typically signaled by incrementing a counter. Hence, what you are seeing is indeed expected behavior.
Thanks for the speedy response! Ok, well that does make sense, although it still might be worth a little note in the docs.
I was wrongly assuming that the EventListener was directly triggered by the js events and that the event
prop was just a convenient way to get the event details... But, it does of course make more sense that the event
propery is just like any other dash property... Anyway, it wasn't immediately obvious that I would need to add in a prop that I don't necessarily care about to catch the event I was listening for, and I imagine it might catch others out when using it for things like resize
events as in #282.
Anyway, thanks again!
Thanks! I'll keep that in mind 👍 . I don't think that it's related to #282 though.
Docs are now updated. http://localhost:7879/components/event_listener
@emilhe New docs look great! I think you meant to post this link :) https://www.dash-extensions.com/components/event_listener
Ah, yes, you are correct 😀
Hi @emilhe, first of all, thanks for the excellent package you have created! Lots of great work in here!!
It's possible this behaviour is actually correct/intentional, but it was not obvious to me at first, and maybe would benefit from a note or warning in the docs.
When listening for the
change
event, I noticed that even though the console logs the change even (usinglogging=True
in yourEventListener
), the callback associated with it only fires once unless theprops
value also changes.Here's a minimal example that demonstrates the issue.
Both trigger once when typing text then changing focus away from the text box.![image](https://github.com/emilhe/dash-extensions/assets/48571510/edcb1d8c-2a7d-405d-84e6-328118d0e2ab)
But, if I change the text in both boxes and then change focus away again, only the one with a prop that changes updates.![image](https://github.com/emilhe/dash-extensions/assets/48571510/907dae0f-ac99-4484-9c11-4dc0833889e0)
Possible that this relates to #282 as I expect that would have similar behaviour since there are no
props
specified.