闪亮的 flexdashboard 中的范围

scoping in shiny flexdashboard

我有一个flexdashboard that uses shiny. Here's a MRE repo and gist.Rmd。当我在 shinyapps.io 上发布该应用程序时,我意识到一个用户的操作可能会影响其他用户。我知道这是一个范围界定问题,但我对范围界定在 Flexdashboard 中的工作方式感到困惑。

This page 解释 'regular' 闪亮应用的范围:

You might want some objects to be visible across all sessions. For example, if you have large data structures, or if you have utility functions that are not reactive (ones that don’t involve the input or output objects), then you can create these objects once and share them across all user sessions (within the same R process), by placing them in app.R , but outside of the server function definition.

在 Flexdashboard 中,没有 app.R 文件或 server 函数。范围界定在这些类型的闪亮应用程序中是如何工作的?

我有几个这样的 eventReactive() 函数,当用户 1 点击提交并在文件末尾触发 observeEvent(input$submit, {}) 时,它们会为用户 2 更新。

eventReactive(rv$run2, {

    if (remote==1) {
      master$df <- drop_read_csv("/dash/master.csv", stringsAsFactors = FALSE)

    } else {
      master$df <- read.csv("dash/master.csv", stringsAsFactors = FALSE)
    }

  }, ignoreNULL = TRUE)

我最初 posted this to RStudio Community 大约 9 小时前,但它并没有产生很多观点 (<20) 或任何讨论。

rv <- reactiveValues() 移出 global 块就成功了。