dashR icon indicating copy to clipboard operation
dashR copied to clipboard

Dash for R should more robustly assert that `output` is a named list

Open rpkyle opened this issue 5 years ago • 0 comments

Currently, app developers can write a callback as follows, which will be evaluated:

            app$callback(
              output("slider-output", "children"),
              list(input("slider-input", "value")),
              function(value) {
                return(sprintf("You have chosen %s on the slider above.", value))
              }
            )

However, the following (confusing) error may appear in the R console if another app remains loaded within a browser tab, resulting in continued requests to the backend, even though the callback map is properly populated:

error: Couldn't find output component.

Please let us know about this error via https://github.com/plotly/dashR/issues/new
request: 127.0.0.1 - ID_127.0.0.1 [24/Feb/2020:09:04:09 -0500] "POST /_dash-update-component HTTP/1.1" 500 0 "http://127.0.0.1:8050/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"

We should probably handle this situation by adding a check to verify that a requested ID is within the callback map, and return a helpful message indicating that it does not exist when absent. This check could be performed for both the R and Python backends, as it does not currently exist for either.

rpkyle avatar Feb 24 '20 14:02 rpkyle