Indentation trouble when communicating between modules with shinymeta

I have several modules and the goal of one of them is to collect all the meta expressions and to put them into a single verbatimTextOutput. After having read this article on communication between modules, I tried to adapt it with shinymeta expressions but I am having some trouble doing so.

Here's an example:

library(shiny)
library(shinymeta)

small_mod_ui <- function(id){
  ns <- NS(id)
  selectInput(ns("test"), "test", choices = names(mtcars))
}
small_mod_server <- function(input, output, session){
  return(
    list(
      test_reactive = metaReactive({
        ..(input$test)
      }), 
      test_reactive_2 = metaReactive({
        ..(input$test)
      })
    )
  )
}

code_mod_ui <- function(id){
  ns <- NS(id)
  verbatimTextOutput(ns("show_code"))
}
code_mod_server <- function(input, output, session, com_between_mods){
  output$show_code <- renderPrint({
    expandChain(
      com_between_mods$test_reactive(),
      com_between_mods$test_reactive_2()
    )
  })
}

ui <- fluidPage(
  small_mod_ui("1"),
  code_mod_ui("1")
)

server <- function(input, output, session) {
  
  com_between_mods <- callModule(small_mod_server, "1")
  callModule(code_mod_server, "1", com_between_mods = com_between_mods)
  
}

shinyApp(ui, server)

Running this example throws this error:

Warning: Error in : :2:2: unexpected input
1: 1_test_reactive <- "mpg"
2: 1_
^
134:

However, replacing

return(
  list(
      test_reactive = metaReactive({
        ..(input$test)
      }), 
      test_reactive_2 = metaReactive({
        ..(input$test)
      })
    )
  )

by

  return(list(test_reactive = metaReactive({ ..(input$test) }), test_reactive_2 = metaReactive({ ..(input$test) }) ))

(on a single line) seems to fix the problem.

Is there an "indentation condition" in shinymeta?

Also asked on StackOverflow

Solved by Joe Cheng on GitHub

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.