Hi everyone,
I asked this question in Rstudio Support, but they were pointing me to standard help files and docs, which I've already gone through. I have a shiny app that parses the ui.R file and, along with getParseData and a bit of tidyverse magic, neatly turns the ui into a dataframe where I can store and use metadata like labels, defaults, etc.
When I run locally/in rstudio server, the function works great. However, when I publish to connect, it breaks my app as the getParseData function returns NULL. Reprex below
parse_ui <- function(.file = here::here("ui.R")){
file_text <- readLines(.file)
parsed_ui <- parse(text = file_text)
parsed_ui_data <- utils::getParseData(parsed_ui, includeText = TRUE)
print(paste("Is parsed UI NULL? : ",is.null(parsed_ui)))
print(paste("Is parsed UI Data NULL? : ",is.null(parsed_ui_data)))
return(parsed_ui_data)
}
I have a simple hack -- add an if else is.null to the function above such that when the file runs locally, write it to a feather file and when its published / returning NULL, read the last saved version instead, but that isn't a bulletproof solution.
Any ideas why this isn't working or better solutions would be appreciated!
Aaron