admin管理员组文章数量:1300200
I have a Shiny app with many module outputs (say cards in a dashboard). Natively Shiny will not render updates until the end of the flush cycle, at which point all UI elements will be updated simultaneously. I don't want this, I want them to be updated as they are done.
I can achieve this using extendedTask. None of the outputs are slow enough to justify actually running them asynchronously (because of the overhead). Instead I can set up an extendedTask per ui elements that only returns TRUE. This works and the module outputs render as soon as they are done, but it's very hacky. It requires a separate R session running, transferring data and so on for no real reason.
Is there some other way to get around this and have outputs rendering immediately without waiting for the end of the flush cycle? I'm thinking it's likely to involve extendedTask somehow. Optimally I'd like to wrap the whole module call in extendedTask but that wouldn't work.
foo <- ExtendedTask$new(function() {
future(
{
TRUE
},
seed = NULL
)
})
observeEvent(genes(), {
foo$invoke()
})
output$some_plot <- renderPlot({
req(foo$result())
req(genes())
# Some plot that only uses genes() and doesn't care at all about foo.
})
本文标签: rUsing extendedTask in Shiny to render UI asynchronouslyStack Overflow
版权声明:本文标题:r - Using extendedTask in Shiny to render UI asynchronously - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741641466a2389943.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论