Skip to content

HtmlWidgets why is a timeout needed (what is the correct timeout) in static reports? #446

Description

@slodge

We've got some issues at present with HtmlWidgets sometimes not showing in RMarkdown reports when using a custom RMarkdown renderer.

Apologies for not supplying a reproducible sample at present - but we're finding reproducibility is fairly tricky! There seems to be something "timing" related as to why some HtmlWidgets get shown and some don't, and the same rendered Html files will sometimes work and sometimes (rarely) fail.

This seems to be something to do with maybeStaticRenderLater and we've found one workaround which helps with this - this is based on some code we found in the FlexDashboard repo - they trigger a "shown" event on a timeout - flexdashboard/flexdashboard.js at b3cb4a396bdfd2fc63a0f000e501fd53fe0122b8 · rstudio/flexdashboard · GitHub

Is a timeout and "shown" event the correct way to go here? Does anyone have any suggestions/ideas about what else should be done here? Is there a DOM, HTMLWidgets, DT or RMarkdown event we can listen for instead of using a timeout? Is there some dependency ordering we should enforce within the rendered HTML? Or any other ideas at all really?

Thanks for any suggestions

Originally asked in: https://community.rstudio.com/t/htmlwidgets-including-dt-how-do-they-render-in-static-rmarkdown-reports/149139

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions