Skip to content
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

getCurrentOutputInfo(): return NULL if not in an output #2707

Merged
merged 3 commits into from
Nov 22, 2019

Conversation

wch
Copy link
Collaborator

@wch wch commented Nov 21, 2019

This is related to rstudio/DT#730.

Previously, this app would throw an error when someone visited it, so the app session wouldn't even start for that user.

library(shiny)
shinyApp(
  ui = fluidPage(
    verbatimTextOutput("txt1"),
    verbatimTextOutput("txt2")
  ),
  server = function(input, output) {
    outside_info <- getCurrentOutputInfo()
    output$txt1 <- renderPrint(outside_info)
    
    output$txt2 <- renderPrint( getCurrentOutputInfo() )
  }
)

After this change, it displays this:

image

@wch wch requested a review from schloerke November 21, 2019 22:18
alandipert added a commit to rstudio/DT that referenced this pull request Nov 21, 2019
wch pushed a commit to rstudio/DT that referenced this pull request Nov 21, 2019
* Use current outputId in dataTableAjax() if available

* Incorporate feedback from @wch

* Update dataTableAjax() docs

* Add ref to rstudio/shiny#2707 in workaround

* Improve comment about workaround
Copy link
Collaborator

@schloerke schloerke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JS travis failure might be due to outdated module deps. Maybe try to run cd tools && yarn && yarn build && cd ../

Returning null seems fair as no info is available. Having an empty list seems more misleading.

@wch wch merged commit d04a990 into master Nov 22, 2019
@wch wch deleted the wch-outputinfo-null branch November 22, 2019 18:38
cpsievert added a commit that referenced this pull request Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants