-
-
Notifications
You must be signed in to change notification settings - Fork 31
Refactor DashR callbacks for increased parity with Dash for Python API #51
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
Merged
Merged
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
87401c2
:hocho: some callback code, :hammer: for parity with Dash :snake:
1e37525
refactoring callbacks for parity with Dash for Python
f59842b
added assert_valid_callbacks
2a4962e
added call to assert_valid_callbacks
d0c4182
corrected missing function declaration
53d37ed
fix silly typo
5f89e80
Update README.md
rpkyle 525bb76
Update DESCRIPTION
rpkyle 4703fb0
:hammer: unify passing inputs and state
da17c59
:hocho: event
c6c4359
fixes for layout rendering
628e23e
replaced stray user_function with func
fc74849
replaced one more user_function with func
63bc0c3
added nested list check for state
dec6ddf
remove default arguments from id and property in helper fns
61feba5
validate that params contain only inputs or states
b88eb58
modified output_value
1db92b4
removed pointless unlist/cast to list
7032150
:white_check_mark: added check for input, state ordering
5951b2b
:bug: fixed check for valid_seq return value
db27e1a
Update README.md
rpkyle ebd11b1
Update README.md
rpkyle 86e5268
Update README.md
rpkyle 99c93ad
Update README.md
rpkyle b54e7aa
Update README.md
rpkyle 1838f7b
Update README.md
rpkyle 53fa11a
adjusting required version for deployment compatibility
7e51f91
:hocho: key field in dependency obj
313dff1
:hocho: key field in payload
f9c9174
:black_circle: wrap layout_render() in invisible
6cf95ff
add short comment to explain layout_render() behaviour
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
Package: dashR | ||
Title: An interface to the dash ecosystem for authoring reactive web applications | ||
Version: 0.0.1 | ||
Version: 0.0.2 | ||
Authors@R: c(person("Ryan", "Kyle", role = c("aut", "cre"), email = "[email protected]"), person("Carson", "Sievert", role = c("aut"))) | ||
Description: An interface to the dash ecosystem for authoring reactive web applications. | ||
Depends: | ||
R (>= 3.5) | ||
R (>= 3.4) | ||
Imports: | ||
R6, | ||
fiery (> 1.0.0), | ||
|
@@ -37,6 +37,3 @@ RoxygenNote: 6.0.1.9000 | |
Roxygen: list(markdown = TRUE) | ||
URL: https://github.com/plotly/dashR | ||
BugReports: https://github.com/plotly/dashR/issues | ||
Remotes: | ||
plotly/dash-html-components@R, | ||
plotly/dash-core-components@R |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 line confuses me a bit, although it might just be my misunderstanding of R. Where is
lay
being used?lay
?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.
Also, why are we calling
layout_render
here? Could we leave 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.
Currently, if you don't assign
layout_render()
to an object, it returns the layout, which will display in the console.There are a couple ways I could handle this -- I can wrap the return in
invisible
, so that it silently returns the layout, which can be assigned to a new object. Or, I can add asilent
option which isTRUE
by default and let the app developer decide.Uh oh!
There was an error while loading. Please reload this page.
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.
I mentioned this last week, but I think it got lost in the shuffle. If we don't render the layout when it's set, I don't believe it will get rendered until a
GET
request occurs and is handled byroutr
unlesslayout_get(render=TRUE)
is called.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.
Because if you didn't return the object but still needed to call
private$layout_render()
, the code would look like:which would actually return
private$layout_render()
(since it's the last line of the function).But if we didn't need to call
private$layout_render()
, then the function would just bewhich wouldn't return anything and be OK.
Am I understanding this correctly?
In Python, there is a convention to call "unused / do not care" arguments
_
(https://hackernoon.com/understanding-the-underscore-of-python-309d1a029edc). Not sure if you can assign variables to_
in R or if R has that convention, but this codeblock might be easier for other folks to understand if it was written: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.
anyway, this isn't blocking, just trying to understand things a bit better!
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.
Oh, no worries -- I appreciate your questions because they often lead me to a better understanding of the way Dash works.
The code (which I've since modified) does not set class attributes or implicitly return
lay
since this line isn't the last one in the function. I've since wrappedlayout_render()
inside a call toinvisible
, which I think has the same effect as assignment to_
in Python. (I actually did not know about that, but it's a cool feature of which I should be aware.)I've added a brief comment to explain what's happening here also.
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, would be nice to understand at some point why this call is necessary (for that matter, I don't quite get why we have a nearly identical call on the Python side 😏) but thanks for making the intention clearer with
invisible
.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.
fixed in f9c9174
Uh oh!
There was an error while loading. Please reload this page.
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.
Missed a question or two here:
Yes, that's right.
Yep, got it -- this line basically says if the first argument of
...
is a function, assign it tolayout
, otherwise wrap all the arguments into a list and assign that intolayout
.