Why aren't my reactive values initialised in the server function unique to each session?


I'm deploying my app to shinyapps and I'm noticing some strange behaviour when I have multiple windows open. I have rendered a datatable and when I update the filters on a window, my table only updates on the last window that was opened.

I have moved my reactive values to be loaded in the server function after reading the scoping documentation.



server <- function(input, output, session) {


observeEvent(input$get_filtered_data, {
    # UpdateTable function takes my table_csv and filters by the date, and updates the riskData reactive value
    UpdateTable(table, input$date)

UpdateTable <- function(table, date) {
#... filter stuff
riskData$data <- filtered_table


#table is a data.frame loaded globally outside of the ui and server functions.
riskData <- reactiveValues(data = table_csv) 

I thought that loading my reactive values in the server function meant that each session would have it's own reactive values? I want to be able to filter a table independently in different sessions.


Any chance you can create a reproducible example for others to run on their own machine? This will make it easier for others to tinker with a solution.