-
-
Notifications
You must be signed in to change notification settings - Fork 977
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
runtime: shinyrmd always renders at startup #2217
Comments
Likely related to the following change: #2203 |
I'll have a look. cc @gadenbuie as #2203 was opened and merged for the need of learnr |
Workaround: The render can be avoided by setting the environment variable Sys.setenv(RMARKDOWN_RUN_PRERENDER = "0")
rmarkdown::render("./server.Rmd")
rmarkdown::run("./server.Rmd") |
I think maybe the problem lies in rmarkdown/R/shiny_prerendered.R Lines 326 to 348 in 61a4cc7
But the
we just don't add the if (!is.null(dependency$package)) {
dependency$pkgVersion <- utils::packageVersion(dependency$package)
} But I don't think this is the right approach. We really shouldn't be using the package version but rather the dependency version (or a combo of both maybe?). For example, a dependency with version I think the above fix is a reasonable short-term bandaid, but my understanding of the shiny prerendered dependency resolution is that much of it was developed alongside early versions of htmltools. Now that htmltools is more mature, we should revisit this section of R Markdown to update the handling of dependencies here. |
Thanks for the quick look and investigation !
Last time I look into it, I had the same impression: Would it work the same with new htmltools ? I'll have a look following your hints and path @gadenbuie ! Thanks a lot! |
@aronatkins I have merged @gadenbuie PR. It fixes the regression from rmarkdown 2.11 introduced while migrating to using jquerylib. I know you have your workarounds, just a heads up that this will be in next 2.12 version. I'll close this here then. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
The 2.11 rmarkdown release (as well as the latest code) always re-renders the HTML before starting the Shiny HTTP server. This is a regression from 2.10 and earlier, which would re-render the HTML only if it was seen as out-dated (per
rmarkdown:::shiny_prerendered_prerender
).Given the following
server.Rmd
andserver.R
:Run this document, stop the server, then check if we see a pre-render as still necessary.
In rmarkdown-2.10, the call to
rmarkdown:::shiny_prerendered_prerender
returnsFALSE
and the second call tormarkdown::run
does not perform a render. This is correct;rmarkdown::run
should not render when its inputs are unchanged.In rmarkdown-2.11, the call to
rmarkdown:::shiny_prerendered_prerender
returnsTRUE
and the second call tormarkdown::run
performs an unnecessary render of the HTML. This is a difference from the previous release; the document is unchanged.It appears as if the following block of code is returning
TRUE
because we are detecting inconsistent package dependencies (when I run,depPkg="jquerylib"
is seen as having adepVer=NULL
, which is enough to trigger the render.rmarkdown/R/shiny_prerendered.R
Lines 256 to 290 in 61a4cc7
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:
formatted your issue so it is easier for us to read?
included a minimal, self-contained, and reproducible example?
pasted the output from
xfun::session_info('rmarkdown')
in your issue?upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
installed and tested your bug with the development version of the rmarkdown package using
remotes::install_github("rstudio/rmarkdown")
?The text was updated successfully, but these errors were encountered: