-
-
Notifications
You must be signed in to change notification settings - Fork 42
Pattern-match callbacks #47
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
end | ||
|
||
#The regular unique works using Set and will not work correctly, because in our case "equal" dependencies have different hashes | ||
#This implementation is not algorithmically efficient (O(n^2)), but it is quite suitable for checking the uniqueness of outputs |
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.
Yep, that should be fine - this only happens when starting the server anyway, we only really care about efficiency during callback requests. Readability and simplicity are more important here.
@@ -37,8 +37,8 @@ using Dash | |||
response = HTTP.handle(handler, request) | |||
@test response.status == 200 | |||
resp_obj = JSON2.read(String(response.body)) | |||
@test !in(:multi, keys(resp_obj)) | |||
@test resp_obj.response.props.children == "test" | |||
@test in(:multi, keys(resp_obj)) |
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.
FYI I see a few trailing whitepaces added in this PR (and a few others removed) - it's a little easier to review if we never have these, do you use an editor that can be set to automatically strip these on saving?
Is the resource refactoring here solving a problem, or just simplifying the structure? |
Initially, I took resources from the R version, where they were grouped into folders. Now it turned out that this version of resources does not support pattern-matching, so I updated the resources to those used in Python dash 1.13.2. Python dash does not split them into directories, and it seemed to me that this is more convenient. |
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.
Beautiful. I don't know all the data type options in Julia, but I can't really imagine a simpler syntax than what you have here with NamedTuples. It looks like this is handled self-consistently, meaning that when you get a pattern-matching ID in callback_context
it's also a NamedTuple
? If I'm interpreting that right, then I'd say let's do it! 💃
It depends on which context parameter we are talking about.
In principle, there is no big problem to make the keys also NamedTuple. Just keep in mind that the order of fields is important in NamedTuple, i.e. |
Perfect. 💃 still applies. |
Pattern-match callbacks.
The functionality is the same as in Python, with a single nuance - NamedTuple is used as the id: