Replicating Google Sheets, Problem with Showing Data Changes

Hello. I have had issues with attempting to replicate a UI that mirrors the functionality of google sheets. Right now my Rshiny app displays a data frame and widgets to the right that allow a user to update a row of this data frame. However I have noticed a few problems when testing out the functionality. They are as followed:

  1. Only the last instance of widget input is saved to the RDS file. So if a user wanted to update row 1 then update row 2 without closing out of the browser, only row 2 would have a lasting record.

  2. The changes made to a row are slow to appear on a new web browser. It often takes three to four minutes of refreshing a new page to see the update. (This is not the case when trouble shooting on the Rstudio launched app, changes appear instantly every time you open a new app).

Please find the creation of an example data frame and the code below.

Creating Data Frame:

KEY = c("key_1", "key_2", "key_3")
VALIDATOR = c(NA, NA, NA)
TIME= c(NA, NA, NA)
SIGN_OFF = c(NA, NA, NA)
TIME.1 = c(NA, NA, NA)

example_data = data.frame(KEY, VALIDATOR ,TIME, SIGN_OFF, TIME.1)
saveRDS(example_data, file = "example_data") 

Rshiny Usage:

library(shiny)
library(dplyr)

input_data = readRDS('example_data')

ui <- fluidPage(
  title = "Data Checklist",
    tabPanel("Verifying Data", fluid = TRUE,
             sidebarLayout(
               sidebarPanel( 
                 
                 radioButtons('type_input', "Type of Update", c("Validating"= 'val', "Sign Off" = 'sign' )),
      
                 textInput("key", "Key Name", "Enter Exact Key"),
                 verbatimTextOutput("value"),
                 
                 textInput("person_name", "Person Name",  ""),
                 verbatimTextOutput("value2"),

                 actionButton(inputId = 'submit_ver','Update'),
                 
                 width = 3
                 
               ),
               
               
               mainPanel(
                 DT::dataTableOutput("mytable1")
               )
             )
    )
  )


server <- function(input, output, session) {
  
  output$mytable1 <- DT::renderDataTable({
    DT::datatable(input_data)   
  })
  

  observeEvent(input$submit_ver, { 
    
    if (input$type_input == "val"){
      
      input_data[input_data$KEY == input$key, "VALIDATOR" ] = input$person_name
      input_data[input_data$KEY == input$key, "TIME" ] = format(Sys.time())
      
      saveRDS(input_data, 'example_data' )
      
      output$mytable1 <- DT::renderDataTable({
        DT::datatable(input_data)
      })
      
    }
    
    else  {
      
      input_data[input_data$KEY == input$key, "SIGN_OFF" ] = input$person_name
      input_data[input_data$KEY == input$key, "TIME.1" ] = format(Sys.time())
      
      saveRDS(input_data, 'example_data' )
      
      
      output$mytable1 <- DT::renderDataTable({
        DT::datatable(input_data)
      })
      
    }
    
  } )
  
}

shinyApp(ui, server)