-
Notifications
You must be signed in to change notification settings - Fork 631
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
Event_data in 4.9.0 missing code to process situation if data is NULL #1538
Comments
related to issue #1528 |
It's important to note that this is a warning, not an error. In this case, the warning is a false positive...notice that this does right thing (prints the relayout event to the R console) observeEvent(event_data("plotly_relayout", source = "testplot"),{
print(event_data("plotly_relayout", source = "testplot"))
}) It's unfortunate, but I don't think I can do anything to suppress the warning in this sort of example (i.e. using |
It is still highly annoying to have false positive warnings. Also since suppressMessages() and suppressWarnings() wrappers don't seem to affect it at all. I'm trying to write my app with zero console printing and 9 pages of plotly errors doesn't look very professional. version 4.8.0 didn't have the warning and I don't see why we need it to be honest. |
I understand it's annoying, but there are good technical reasons as to why If you need to get rid of the warnings, you can do this relayout_data <- reactive({
req(values$testData)
event_data("plotly_relayout", source = "testplot")
})
observeEvent(relayout_data(),{
print(relayout_data())
}) The |
Thanks for the help cpsievert! Don't ask me how, but this still gives me the error messages. I'm going to try and find out if I can reproduce it in a minimal example. Ok, small update: the plot I'm trying to solve this for is normally inside a dropdownButton. Once I moved the plot out into the main page, the warning disappeared. However, if the plot is somewhere else, the reactive approach still happily generates the error, as the data needed for the plot is available (after going through the loading files procedure in my app, but the plot is not build until the dropdownbutton is opened, and between loading data and displaying the plot, the warning still happens..... sadly I don't see how there is a way to construct a way to so to say "req("is the plot actually build yet")" approach |
I would be very curious to hear the necessity for the warning message and why returning NULL until there is actual event data isn't sufficient. I can understand perhaps some need for a specific output in some situations, but I honestly don't see the need for merely printing a message on console that you can't get rid off no matter what. It's just a message, without any further implications on anything so I don't see how that "is needed" as you stated. |
Adding the |
@RyanMorton-USDA a fix was recently merged related to this (#2337). Do your problems go away with the development version ( |
First, thank you! We can give it a go, but it's a largish gov't app that needs stable versions. If it does work, any idea on a release date. |
@RyanMorton-USDA
then
|
I'm doubtful that this elaborate workaround will actually solve the problem in a larger app, mainly since the code that actually throws this warning is already waiting on a session flush: Lines 151 to 156 in cc49ee5
But even if it did suppress the warning, I'd still feel that doing such an elaborate workaround shouldn't be necessary. There's a performance penalty, and even more importantly a code complexity penalty, to adding additional reactive values. Whereas it would be trivial for plotly to add a way to suppress it that didn't add such additional complexity. |
It seems that in the new R plotly 4.9.0 version, there is a change in the event_data code that causes errors if the plot is not yet build.
i.e. a situation where a plot_ly plot is not build because the data it needs is not yet available in the plot by means of a req(data) inside the plot_ly() block. The observeEvent(event_data("plotly_click", source = 'A_plot'), { ....}) used to work fine before, but now throws errors, and does so for all forms of event_data.
example of an error message I get now:
The app below demonstrates the problem with version 4.9.0:
The text was updated successfully, but these errors were encountered: