How to give precedence to one observer over other observers in R Shiny code?

In the R Shiny code below there are two user input tables: parentTbl and childTbl. Both are generated using rhandsontable. The user can input two “Y” values into the parentTbl input table which in the full code applies these Y variables over time window “W”. Values in parentTbl flow downstream into a group of two linked and detailed user input tables called “childTbl”. The user can optionally enter values into any one of the two childTbl user input tables. In childTbl the user can alter the variable Y at time period “X” by inserting new rows via right mouse click and entering values into the added rows of the rhandsontable. Regardless of which table the user inputs values into, whether parentTbl or childTbl or both or none, values flow from parentTbl to childTbl to a calculation model (not shown). Note that the first row of parentTbl is directly linked to and corresponds to childTbl “Var_A”, the second row of parentTbl is directly linked to and corresponds to childTbl “Var_B”. Basically, childTbl allows the user the explode the values input into parentTbl.

Variable “W” for time window (per the slider input$periods) serves as the outer perimeter for variable X in the childTbl.

If the user has built up a childTbl (without changing input$periods) and then enters a new value into the corresponding row of the parentTbl, then the associated childTbl correctly resets as shown in the 1st image below.

If the user has built up a childTbl and then changes input$periods to a value less than the value in an X column of a childTbl, then those childTbl rows are automatically and correctly deleted as shown in the 2nd image below.

However, if the user has built up a childTbl and then changes input$periods, then the corresponding childTbl no longer resets upon a change to parentTbl as shown in the 3rd image below.

How do I make this reset mechanism upon a parentTbl input take precedence over all other observers and operations in all scenarios? Changing a parentTbl value should always reset the corresponding childTbl, and only that childTbl and not all the childTbl tables. While not losing any other functionality, such as resetting only the childTbl associated with the parentTbl row that is modified by user input and deleting only those childTbl rows where its X value > value of new input$periods.

Here it the reduced code, I left in many print() statements for reactive variable tracking making the code look longer than it need be:

library(rhandsontable)
library(shiny)

testVars <- c("Var_A","Var_B")  
dft_vals <- c(18, 6)
names(dft_vals) <- testVars

ui <- 
  fluidPage(
    sliderInput("periods", "Time window (W):", min = 1, max = 60 * 2, value = 60), 
    h5(strong("Variable (Y) over window (W):")),
    rHandsontableOutput("parentTbl"), 
    uiOutput("childTbl")
  ) 

server <- function(input,output,session)({    
    parentVars <- lapply(testVars, function(var) reactiveValues(data = dft_vals[var]))
    grpInputs <- reactiveValues(tables = list())
    output$parentTbl <- renderRHandsontable({
      rhandsontable(
        data.frame(Inputs = sapply(parentVars, function(x) x$data)),
        readOnly = FALSE,
        colHeaders = NULL,
        rowHeaders = testVars,
        contextMenu = FALSE
      ) 
    })

    observeEvent(input$parentTbl, {
      newValues <- hot_to_r(input$parentTbl)$Inputs
      for (i in 1:2) {
        if (parentVars[[i]]$data != newValues[i]) {
          print(paste("Row ID:", testVars[i], "New Value:", newValues[i])) 
          grpInputs$tbl[[testVars[i]]] <- data.frame(X = 1, Y = newValues[i])
        }
        parentVars[[i]]$data <- newValues[i]
      }
    })
    
    observe({
      print("Contents of parentVars:")
      for (i in 1:length(parentVars)){print(parentVars[[i]]$data)}
      print("Contents of grpInputs:")
      print(reactiveValuesToList(grpInputs))
    })
    
    # Below block eliminates child table rows where column X > input$periods
    observeEvent(input$periods, {
      lapply(testVars, function(varInputId) {
        if (!is.null(grpInputs$tbl[[varInputId]])) {
          updated_tbl <- grpInputs$tbl[[varInputId]]
          updated_tbl <- subset(updated_tbl, X <= input$periods)
          grpInputs$tbl[[varInputId]] <- updated_tbl
          output[[varInputId]] <- renderRHandsontable({
            rhandsontable(updated_tbl, contextMenu = TRUE, rowHeaders = FALSE) %>%
              hot_validate_numeric(col = 1, min = 1, max = input$periods) 
          })
        }
      })
    })
    
    # Below block builds child X/Y tables 
    lapply(1:2, function(i) {
      varInputId <- testVars[i]
      output[[varInputId]] <- renderRHandsontable({
        df <- data.frame(X = 1, Y = parentVars[[i]]$data)
        rhandsontable(df, contextMenu = TRUE, minRows = 1, rowHeaders = FALSE) %>%
          hot_validate_numeric(col = 1, min = 1, max = input$periods)
      })
    })
    
    output$childTbl <- renderUI({
      lapply(1:2, function(i) {
        varInputId <- testVars[i]
        list(
          h5(strong(paste("Adjust ", varInputId, " (Y) at time X:"))),
          rHandsontableOutput(varInputId)
        )
      })
    })
    
    # Below keeps childTbl from resetting due to change in input$periods
    observe({
      lapply(1:2, function(i) {
        varInputId <- testVars[i]
        if (!is.null(input[[varInputId]])) {
          grpInputs$tbl[[i]] <- tryCatch({
            hot_to_r(input[[varInputId]])
          }, error = function(e) {
            grpInputs$tbl[[i]]
          })
          names(grpInputs$tbl)[i] <- varInputId
        }
      })
    })
})

shinyApp(ui = ui, server = server)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật