Removed unnecessary checks for the validity of callbacks#138
Conversation
src/handler/callback_context.jl
Outdated
| if !isempty(changed_props) | ||
| triggered = TriggeredParam[(prop_id = id, value = input_values[id]) for id in changed_props] | ||
| else | ||
| triggered = FakeTriggeredParams() |
There was a problem hiding this comment.
On the Python side we did this because for a long time callback_context.triggered always had at least one element in it - in fact, nearly always exactly one - so it was a very common pattern for users to just look at the first list item without first checking that it exists, and when we changed it so in some cases there's nothing in the list we didn't want all that code to error out. Is there a lot of existing Dash.jl user code that will break without this? If not, I'd leave it out, it'll be cleaner.
There was a problem hiding this comment.
This is clearly not used now in Julia because it didn't work that way before. I decided to do this for uniformity with python and in order for the example from the issue #137 to work as is. However, if it is not necessary, then I will remove it, because it is confusing logic.
There was a problem hiding this comment.
OK good, that's what I thought - let's remove it.
Co-authored-by: Alex Johnson <johnson.alex.c@gmail.com>
Removed unnecessary validation checks of callbacks parameters in accordance with the issue #137
I also added an analog of FalseList (from https://github.com/plotly/dash/blob/71401b5f9e8ddd835761cd080fa06562eb0523e1/dash/_callback_context.py) for the context.triggered in case when triggered_inputs are empty