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

get_session_object function needs to be more robust #28

Closed
denisovan31415 opened this issue May 11, 2022 · 1 comment
Closed

get_session_object function needs to be more robust #28

denisovan31415 opened this issue May 11, 2022 · 1 comment
Assignees

Comments

@denisovan31415
Copy link
Contributor

Current function definition:

get_session_object <- function() {
  if (shiny::isRunning()) {
    getDefaultReactiveDomain()
  } else {
    if ("session" %in% ls(envir = .GlobalEnv)) {
      return(get("session", envir = .GlobalEnv))
    } else {
      stop("Cannot find 'session' object in .GlobalEnv.")
    }
  }
}

How it can easily break:

session <- 1
get_session_object()
[1] 1
teal.code::init_chunks()
Error: $ operator is invalid for atomic vectors
@gogonzo
Copy link
Contributor

gogonzo commented May 13, 2022

duplicate of #22

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

No branches or pull requests

2 participants