-
-
Notifications
You must be signed in to change notification settings - Fork 42
Removed unnecessary checks for the validity of callbacks #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK good, that's what I thought - let's remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in da85fa9
Co-authored-by: Alex Johnson <johnson.alex.c@gmail.com>
alexcjohnson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
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