Open nanxstats opened 8 months ago
Thanks for the report @nanxstats! This seems specific to learnr, or have you seen this behavior with other rmarkdown formats? If not, I'll move this over to the learnr bug tracker.
@gadenbuie Sure thing. I think this issue is more prevalent for learnr projects because it's probably a major source of usage of the shiny_prerendered
runtime, although the fix could come from different places.
@nanxstats Can you try this with another shiny prerendered document that isn't a learnr tutorial? Does it also create problematic behavior under similar circumstances (where an unrelated DESCRIPTION file exists in a parent directory)?
@gadenbuie Good idea. I further tried the two examples in Prerendered Shiny Documents with html_document
and flex_dashboard
outputs - the Shiny components in both of them work ok even with the unrelated DESCRIPTION
file in the parent directory. This might suggest the issue is more learnr-specific.
Also, here is a slightly updated minimal reproducible example - it gives a better hint on where the error happened (a read.dcf()
call somewhere):
usethis::create_project("example")
# In the new project
usethis::use_description()
writeLines(append(readLines("DESCRIPTION"), "Imports", after = 1), "DESCRIPTION")
fs::file_move("DESCRIPTION", "~/DESCRIPTION")
rmarkdown::draft("example.Rmd", template = "tutorial", package = "learnr", create_dir = FALSE, edit = FALSE)
Run document:
Loading required package: shiny
Listening on http://127.0.0.1:3852
Warning: Error in read.dcf: Invalid DCF format.
Regular lines must have a tag.
Offending lines start with:
Imports
3: <Anonymous>
1: rmarkdown::run
@gadenbuie do you want to move this issue then as it seems learnr related ?
Though we do read dcf in this code base when handling dependencies https://github.com/rstudio/rmarkdown/blob/07e2a9902915eef52ab0b085ca344f1a371dcdf0/R/shiny_prerendered.R#L330-L353
We do try to find project root but related to a dependency file. Is there also a read dcf call in learnr ? Or would this be this one ?
Under specific conditions, rmarkdown/learnr incorrectly searches for and attempts to parse a
DESCRIPTION
file outside the intended project directory. This issue arises if theDESCRIPTION
file contains errors such as formatting issues, causing the quiz component to remain in a "loading" state. This state persists without providing an error message to identify the issue for developers or users.In Posit Workbench, this problem becomes a HTTP 500 error in the Chrome DevTools Network tab, with a possible DCF parsing error message in the response.
Minimal reproducible example
In the new project window, run
Open
example.Rmd
, run the document, and navigate to "Topic 2". The quiz will display "Loading..." instead of the content.Session info
Checklist
When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:
[x] formatted your issue so it is easier for us to read?
[x] included a minimal, self-contained, and reproducible example?
[x] pasted the output from
xfun::session_info('rmarkdown')
in your issue?[x] upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
[x] installed and tested your bug with the development version of the rmarkdown package using
remotes::install_github("rstudio/rmarkdown")
?