Loading shiny module only when menu items is clicked












2















Background



Within a modular1 Shiny application, I would like to load module only when menu item on shinydashboard is clicked. If the menu item is not accessed I wouldn't like to load the module.



Basic application



app.R



# Libs
library(shiny)
library(shinydashboard)

# Source module
source("sample_module.R")

ui <- dashboardPage(
dashboardHeader(title = "Dynamic sidebar"),
dashboardSidebar(sidebarMenuOutput("menu")),
dashboardBody(tabItems(
tabItem(tabName = "tab_one", h1("Tab One")),
tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
))
)

server <- function(input, output) {

callModule(sampleModuleServer, "sampleModule")

output$menu <- renderMenu({
sidebarMenu(
menuItem(
"Menu item 1",
icon = icon("calendar"),
tabName = "tab_one"
),
menuItem(
"Menu item 2",
icon = icon("globe"),
tabName = "tab_two"
)
)
})
}

shinyApp(ui, server)


sample_module.R



sampleModuleServer <- function(input, output, session) {
output$plot1 <- renderPlot({
plot(mtcars)
})
}

sampleModuleUI <- function(id) {
ns <- NS(id)

plotOutput(ns("plot1"))

}


Desired implementation



The desired implementation would load sample_module only when the relevant menu item is clicked. On the lines of 2:



Don't call callModule from inside observeEvent; keep it at the top level. Take the reactive expression that's returned, and use eventReactive to wrap it in the button click. And use the eventReactive from your outputs, etc.




x <- callModule(...)
y <- eventReactive(input$go, x())
output$tbl <- DT::renderDataTable(y())



Attempt




app.R (modified)



# Libs
library(shiny)
library(shinydashboard)

# Source module
source("sample_module.R")

ui <- dashboardPage(
dashboardHeader(title = "Dynamic sidebar"),
dashboardSidebar(sidebarMenuOutput("menu")),
dashboardBody(tabItems(
tabItem(tabName = "tab_one", h1("Tab One")),
tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
))
)

server <- function(input, output) {

eventReactive(eventExpr = input$tab_two,
valueExpr = callModule(sampleModuleServer, "sampleModule")
)

output$menu <- renderMenu({
sidebarMenu(
menuItem(
"Menu item 1",
icon = icon("calendar"),
tabName = "tab_one"
),
menuItem(
"Menu item 2",
icon = icon("globe"),
tabName = "tab_two"
)
)
})
}

shinyApp(ui, server)


Problem



Application runs but the module does not load. Questions:




  • How to correctly call eventReactive on dashboard menu item? The tab_item does not seem to have id parameter is tabName equivalent in that context?

  • The linked discussion refers to refreshing one table. I'm trying to figure out example that will work with modules containing numerous interface element and elaborate server calls.


Clicking on Menu item 2 should display the content from the sample_module.R file.



application layout





1Modularizing Shiny app code



2Google groups: activate module with actionButton





Update



I've tried explicitly forcing module into application environment load using the following syntax:



eventReactive(eventExpr = input$tab_two,
valueExpr = callModule(sampleModuleServer, "sampleModule"),
domain = MainAppDomain
)


where



MainAppDomain <- getDefaultReactiveDomain()









share|improve this question





























    2















    Background



    Within a modular1 Shiny application, I would like to load module only when menu item on shinydashboard is clicked. If the menu item is not accessed I wouldn't like to load the module.



    Basic application



    app.R



    # Libs
    library(shiny)
    library(shinydashboard)

    # Source module
    source("sample_module.R")

    ui <- dashboardPage(
    dashboardHeader(title = "Dynamic sidebar"),
    dashboardSidebar(sidebarMenuOutput("menu")),
    dashboardBody(tabItems(
    tabItem(tabName = "tab_one", h1("Tab One")),
    tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
    ))
    )

    server <- function(input, output) {

    callModule(sampleModuleServer, "sampleModule")

    output$menu <- renderMenu({
    sidebarMenu(
    menuItem(
    "Menu item 1",
    icon = icon("calendar"),
    tabName = "tab_one"
    ),
    menuItem(
    "Menu item 2",
    icon = icon("globe"),
    tabName = "tab_two"
    )
    )
    })
    }

    shinyApp(ui, server)


    sample_module.R



    sampleModuleServer <- function(input, output, session) {
    output$plot1 <- renderPlot({
    plot(mtcars)
    })
    }

    sampleModuleUI <- function(id) {
    ns <- NS(id)

    plotOutput(ns("plot1"))

    }


    Desired implementation



    The desired implementation would load sample_module only when the relevant menu item is clicked. On the lines of 2:



    Don't call callModule from inside observeEvent; keep it at the top level. Take the reactive expression that's returned, and use eventReactive to wrap it in the button click. And use the eventReactive from your outputs, etc.




    x <- callModule(...)
    y <- eventReactive(input$go, x())
    output$tbl <- DT::renderDataTable(y())



    Attempt




    app.R (modified)



    # Libs
    library(shiny)
    library(shinydashboard)

    # Source module
    source("sample_module.R")

    ui <- dashboardPage(
    dashboardHeader(title = "Dynamic sidebar"),
    dashboardSidebar(sidebarMenuOutput("menu")),
    dashboardBody(tabItems(
    tabItem(tabName = "tab_one", h1("Tab One")),
    tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
    ))
    )

    server <- function(input, output) {

    eventReactive(eventExpr = input$tab_two,
    valueExpr = callModule(sampleModuleServer, "sampleModule")
    )

    output$menu <- renderMenu({
    sidebarMenu(
    menuItem(
    "Menu item 1",
    icon = icon("calendar"),
    tabName = "tab_one"
    ),
    menuItem(
    "Menu item 2",
    icon = icon("globe"),
    tabName = "tab_two"
    )
    )
    })
    }

    shinyApp(ui, server)


    Problem



    Application runs but the module does not load. Questions:




    • How to correctly call eventReactive on dashboard menu item? The tab_item does not seem to have id parameter is tabName equivalent in that context?

    • The linked discussion refers to refreshing one table. I'm trying to figure out example that will work with modules containing numerous interface element and elaborate server calls.


    Clicking on Menu item 2 should display the content from the sample_module.R file.



    application layout





    1Modularizing Shiny app code



    2Google groups: activate module with actionButton





    Update



    I've tried explicitly forcing module into application environment load using the following syntax:



    eventReactive(eventExpr = input$tab_two,
    valueExpr = callModule(sampleModuleServer, "sampleModule"),
    domain = MainAppDomain
    )


    where



    MainAppDomain <- getDefaultReactiveDomain()









    share|improve this question



























      2












      2








      2








      Background



      Within a modular1 Shiny application, I would like to load module only when menu item on shinydashboard is clicked. If the menu item is not accessed I wouldn't like to load the module.



      Basic application



      app.R



      # Libs
      library(shiny)
      library(shinydashboard)

      # Source module
      source("sample_module.R")

      ui <- dashboardPage(
      dashboardHeader(title = "Dynamic sidebar"),
      dashboardSidebar(sidebarMenuOutput("menu")),
      dashboardBody(tabItems(
      tabItem(tabName = "tab_one", h1("Tab One")),
      tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
      ))
      )

      server <- function(input, output) {

      callModule(sampleModuleServer, "sampleModule")

      output$menu <- renderMenu({
      sidebarMenu(
      menuItem(
      "Menu item 1",
      icon = icon("calendar"),
      tabName = "tab_one"
      ),
      menuItem(
      "Menu item 2",
      icon = icon("globe"),
      tabName = "tab_two"
      )
      )
      })
      }

      shinyApp(ui, server)


      sample_module.R



      sampleModuleServer <- function(input, output, session) {
      output$plot1 <- renderPlot({
      plot(mtcars)
      })
      }

      sampleModuleUI <- function(id) {
      ns <- NS(id)

      plotOutput(ns("plot1"))

      }


      Desired implementation



      The desired implementation would load sample_module only when the relevant menu item is clicked. On the lines of 2:



      Don't call callModule from inside observeEvent; keep it at the top level. Take the reactive expression that's returned, and use eventReactive to wrap it in the button click. And use the eventReactive from your outputs, etc.




      x <- callModule(...)
      y <- eventReactive(input$go, x())
      output$tbl <- DT::renderDataTable(y())



      Attempt




      app.R (modified)



      # Libs
      library(shiny)
      library(shinydashboard)

      # Source module
      source("sample_module.R")

      ui <- dashboardPage(
      dashboardHeader(title = "Dynamic sidebar"),
      dashboardSidebar(sidebarMenuOutput("menu")),
      dashboardBody(tabItems(
      tabItem(tabName = "tab_one", h1("Tab One")),
      tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
      ))
      )

      server <- function(input, output) {

      eventReactive(eventExpr = input$tab_two,
      valueExpr = callModule(sampleModuleServer, "sampleModule")
      )

      output$menu <- renderMenu({
      sidebarMenu(
      menuItem(
      "Menu item 1",
      icon = icon("calendar"),
      tabName = "tab_one"
      ),
      menuItem(
      "Menu item 2",
      icon = icon("globe"),
      tabName = "tab_two"
      )
      )
      })
      }

      shinyApp(ui, server)


      Problem



      Application runs but the module does not load. Questions:




      • How to correctly call eventReactive on dashboard menu item? The tab_item does not seem to have id parameter is tabName equivalent in that context?

      • The linked discussion refers to refreshing one table. I'm trying to figure out example that will work with modules containing numerous interface element and elaborate server calls.


      Clicking on Menu item 2 should display the content from the sample_module.R file.



      application layout





      1Modularizing Shiny app code



      2Google groups: activate module with actionButton





      Update



      I've tried explicitly forcing module into application environment load using the following syntax:



      eventReactive(eventExpr = input$tab_two,
      valueExpr = callModule(sampleModuleServer, "sampleModule"),
      domain = MainAppDomain
      )


      where



      MainAppDomain <- getDefaultReactiveDomain()









      share|improve this question
















      Background



      Within a modular1 Shiny application, I would like to load module only when menu item on shinydashboard is clicked. If the menu item is not accessed I wouldn't like to load the module.



      Basic application



      app.R



      # Libs
      library(shiny)
      library(shinydashboard)

      # Source module
      source("sample_module.R")

      ui <- dashboardPage(
      dashboardHeader(title = "Dynamic sidebar"),
      dashboardSidebar(sidebarMenuOutput("menu")),
      dashboardBody(tabItems(
      tabItem(tabName = "tab_one", h1("Tab One")),
      tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
      ))
      )

      server <- function(input, output) {

      callModule(sampleModuleServer, "sampleModule")

      output$menu <- renderMenu({
      sidebarMenu(
      menuItem(
      "Menu item 1",
      icon = icon("calendar"),
      tabName = "tab_one"
      ),
      menuItem(
      "Menu item 2",
      icon = icon("globe"),
      tabName = "tab_two"
      )
      )
      })
      }

      shinyApp(ui, server)


      sample_module.R



      sampleModuleServer <- function(input, output, session) {
      output$plot1 <- renderPlot({
      plot(mtcars)
      })
      }

      sampleModuleUI <- function(id) {
      ns <- NS(id)

      plotOutput(ns("plot1"))

      }


      Desired implementation



      The desired implementation would load sample_module only when the relevant menu item is clicked. On the lines of 2:



      Don't call callModule from inside observeEvent; keep it at the top level. Take the reactive expression that's returned, and use eventReactive to wrap it in the button click. And use the eventReactive from your outputs, etc.




      x <- callModule(...)
      y <- eventReactive(input$go, x())
      output$tbl <- DT::renderDataTable(y())



      Attempt




      app.R (modified)



      # Libs
      library(shiny)
      library(shinydashboard)

      # Source module
      source("sample_module.R")

      ui <- dashboardPage(
      dashboardHeader(title = "Dynamic sidebar"),
      dashboardSidebar(sidebarMenuOutput("menu")),
      dashboardBody(tabItems(
      tabItem(tabName = "tab_one", h1("Tab One")),
      tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
      ))
      )

      server <- function(input, output) {

      eventReactive(eventExpr = input$tab_two,
      valueExpr = callModule(sampleModuleServer, "sampleModule")
      )

      output$menu <- renderMenu({
      sidebarMenu(
      menuItem(
      "Menu item 1",
      icon = icon("calendar"),
      tabName = "tab_one"
      ),
      menuItem(
      "Menu item 2",
      icon = icon("globe"),
      tabName = "tab_two"
      )
      )
      })
      }

      shinyApp(ui, server)


      Problem



      Application runs but the module does not load. Questions:




      • How to correctly call eventReactive on dashboard menu item? The tab_item does not seem to have id parameter is tabName equivalent in that context?

      • The linked discussion refers to refreshing one table. I'm trying to figure out example that will work with modules containing numerous interface element and elaborate server calls.


      Clicking on Menu item 2 should display the content from the sample_module.R file.



      application layout





      1Modularizing Shiny app code



      2Google groups: activate module with actionButton





      Update



      I've tried explicitly forcing module into application environment load using the following syntax:



      eventReactive(eventExpr = input$tab_two,
      valueExpr = callModule(sampleModuleServer, "sampleModule"),
      domain = MainAppDomain
      )


      where



      MainAppDomain <- getDefaultReactiveDomain()






      r shiny shinydashboard shiny-reactivity






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 9:41







      Konrad

















      asked Oct 29 '18 at 16:14









      KonradKonrad

      7,458953101




      7,458953101
























          1 Answer
          1






          active

          oldest

          votes


















          2





          +50









          Edit: Dropping Joe Cheng's top level statement:



          # Libs
          library(shiny)
          library(shinydashboard)

          # Source module
          source("sample_module.R")

          ui <- dashboardPage(
          dashboardHeader(title = "Dynamic sidebar"),
          dashboardSidebar(sidebarMenuOutput("menu")),
          dashboardBody(tabItems(
          tabItem(tabName = "tab_one", h1("Tab One")),
          tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
          ))
          )

          server <- function(input, output) {

          observeEvent(input$tabs,{
          if(input$tabs=="tab_two"){
          callModule(sampleModuleServer, "sampleModule")
          }
          }, ignoreNULL = TRUE, ignoreInit = TRUE)

          output$menu <- renderMenu({
          sidebarMenu(id = "tabs",
          menuItem(
          "Menu item 1",
          icon = icon("calendar"),
          tabName = "tab_one"
          ),
          menuItem(
          "Menu item 2",
          icon = icon("globe"),
          tabName = "tab_two"
          )
          )
          })
          }

          shinyApp(ui, server)


          Furthermore, your sidebarMenu needs an id to access the selected tabs; please see the shinydashboard documentation.






          share|improve this answer


























          • Thanks very much for showing the interest. Not sure if this does the job. To test, Within sampleModuleServer I've included stop("Module loaded, crashing..."). Now the app crashes on start (it does not launch). Whereas to my mind, it shouldn't it should only crash if I trigger the event calling this module (clicking on the link). Is that a sensible assumption?

            – Konrad
            Nov 21 '18 at 16:30











          • Well, then it seems we need to join the dark side and use observeEvent anyway. - please check my edit.

            – ismirsehregal
            Nov 21 '18 at 18:23













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53049659%2floading-shiny-module-only-when-menu-items-is-clicked%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2





          +50









          Edit: Dropping Joe Cheng's top level statement:



          # Libs
          library(shiny)
          library(shinydashboard)

          # Source module
          source("sample_module.R")

          ui <- dashboardPage(
          dashboardHeader(title = "Dynamic sidebar"),
          dashboardSidebar(sidebarMenuOutput("menu")),
          dashboardBody(tabItems(
          tabItem(tabName = "tab_one", h1("Tab One")),
          tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
          ))
          )

          server <- function(input, output) {

          observeEvent(input$tabs,{
          if(input$tabs=="tab_two"){
          callModule(sampleModuleServer, "sampleModule")
          }
          }, ignoreNULL = TRUE, ignoreInit = TRUE)

          output$menu <- renderMenu({
          sidebarMenu(id = "tabs",
          menuItem(
          "Menu item 1",
          icon = icon("calendar"),
          tabName = "tab_one"
          ),
          menuItem(
          "Menu item 2",
          icon = icon("globe"),
          tabName = "tab_two"
          )
          )
          })
          }

          shinyApp(ui, server)


          Furthermore, your sidebarMenu needs an id to access the selected tabs; please see the shinydashboard documentation.






          share|improve this answer


























          • Thanks very much for showing the interest. Not sure if this does the job. To test, Within sampleModuleServer I've included stop("Module loaded, crashing..."). Now the app crashes on start (it does not launch). Whereas to my mind, it shouldn't it should only crash if I trigger the event calling this module (clicking on the link). Is that a sensible assumption?

            – Konrad
            Nov 21 '18 at 16:30











          • Well, then it seems we need to join the dark side and use observeEvent anyway. - please check my edit.

            – ismirsehregal
            Nov 21 '18 at 18:23


















          2





          +50









          Edit: Dropping Joe Cheng's top level statement:



          # Libs
          library(shiny)
          library(shinydashboard)

          # Source module
          source("sample_module.R")

          ui <- dashboardPage(
          dashboardHeader(title = "Dynamic sidebar"),
          dashboardSidebar(sidebarMenuOutput("menu")),
          dashboardBody(tabItems(
          tabItem(tabName = "tab_one", h1("Tab One")),
          tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
          ))
          )

          server <- function(input, output) {

          observeEvent(input$tabs,{
          if(input$tabs=="tab_two"){
          callModule(sampleModuleServer, "sampleModule")
          }
          }, ignoreNULL = TRUE, ignoreInit = TRUE)

          output$menu <- renderMenu({
          sidebarMenu(id = "tabs",
          menuItem(
          "Menu item 1",
          icon = icon("calendar"),
          tabName = "tab_one"
          ),
          menuItem(
          "Menu item 2",
          icon = icon("globe"),
          tabName = "tab_two"
          )
          )
          })
          }

          shinyApp(ui, server)


          Furthermore, your sidebarMenu needs an id to access the selected tabs; please see the shinydashboard documentation.






          share|improve this answer


























          • Thanks very much for showing the interest. Not sure if this does the job. To test, Within sampleModuleServer I've included stop("Module loaded, crashing..."). Now the app crashes on start (it does not launch). Whereas to my mind, it shouldn't it should only crash if I trigger the event calling this module (clicking on the link). Is that a sensible assumption?

            – Konrad
            Nov 21 '18 at 16:30











          • Well, then it seems we need to join the dark side and use observeEvent anyway. - please check my edit.

            – ismirsehregal
            Nov 21 '18 at 18:23
















          2





          +50







          2





          +50



          2




          +50





          Edit: Dropping Joe Cheng's top level statement:



          # Libs
          library(shiny)
          library(shinydashboard)

          # Source module
          source("sample_module.R")

          ui <- dashboardPage(
          dashboardHeader(title = "Dynamic sidebar"),
          dashboardSidebar(sidebarMenuOutput("menu")),
          dashboardBody(tabItems(
          tabItem(tabName = "tab_one", h1("Tab One")),
          tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
          ))
          )

          server <- function(input, output) {

          observeEvent(input$tabs,{
          if(input$tabs=="tab_two"){
          callModule(sampleModuleServer, "sampleModule")
          }
          }, ignoreNULL = TRUE, ignoreInit = TRUE)

          output$menu <- renderMenu({
          sidebarMenu(id = "tabs",
          menuItem(
          "Menu item 1",
          icon = icon("calendar"),
          tabName = "tab_one"
          ),
          menuItem(
          "Menu item 2",
          icon = icon("globe"),
          tabName = "tab_two"
          )
          )
          })
          }

          shinyApp(ui, server)


          Furthermore, your sidebarMenu needs an id to access the selected tabs; please see the shinydashboard documentation.






          share|improve this answer















          Edit: Dropping Joe Cheng's top level statement:



          # Libs
          library(shiny)
          library(shinydashboard)

          # Source module
          source("sample_module.R")

          ui <- dashboardPage(
          dashboardHeader(title = "Dynamic sidebar"),
          dashboardSidebar(sidebarMenuOutput("menu")),
          dashboardBody(tabItems(
          tabItem(tabName = "tab_one", h1("Tab One")),
          tabItem(tabName = "tab_two", sampleModuleUI("sampleModule"))
          ))
          )

          server <- function(input, output) {

          observeEvent(input$tabs,{
          if(input$tabs=="tab_two"){
          callModule(sampleModuleServer, "sampleModule")
          }
          }, ignoreNULL = TRUE, ignoreInit = TRUE)

          output$menu <- renderMenu({
          sidebarMenu(id = "tabs",
          menuItem(
          "Menu item 1",
          icon = icon("calendar"),
          tabName = "tab_one"
          ),
          menuItem(
          "Menu item 2",
          icon = icon("globe"),
          tabName = "tab_two"
          )
          )
          })
          }

          shinyApp(ui, server)


          Furthermore, your sidebarMenu needs an id to access the selected tabs; please see the shinydashboard documentation.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 21 '18 at 18:22

























          answered Nov 21 '18 at 16:12









          ismirsehregalismirsehregal

          1,6341212




          1,6341212













          • Thanks very much for showing the interest. Not sure if this does the job. To test, Within sampleModuleServer I've included stop("Module loaded, crashing..."). Now the app crashes on start (it does not launch). Whereas to my mind, it shouldn't it should only crash if I trigger the event calling this module (clicking on the link). Is that a sensible assumption?

            – Konrad
            Nov 21 '18 at 16:30











          • Well, then it seems we need to join the dark side and use observeEvent anyway. - please check my edit.

            – ismirsehregal
            Nov 21 '18 at 18:23





















          • Thanks very much for showing the interest. Not sure if this does the job. To test, Within sampleModuleServer I've included stop("Module loaded, crashing..."). Now the app crashes on start (it does not launch). Whereas to my mind, it shouldn't it should only crash if I trigger the event calling this module (clicking on the link). Is that a sensible assumption?

            – Konrad
            Nov 21 '18 at 16:30











          • Well, then it seems we need to join the dark side and use observeEvent anyway. - please check my edit.

            – ismirsehregal
            Nov 21 '18 at 18:23



















          Thanks very much for showing the interest. Not sure if this does the job. To test, Within sampleModuleServer I've included stop("Module loaded, crashing..."). Now the app crashes on start (it does not launch). Whereas to my mind, it shouldn't it should only crash if I trigger the event calling this module (clicking on the link). Is that a sensible assumption?

          – Konrad
          Nov 21 '18 at 16:30





          Thanks very much for showing the interest. Not sure if this does the job. To test, Within sampleModuleServer I've included stop("Module loaded, crashing..."). Now the app crashes on start (it does not launch). Whereas to my mind, it shouldn't it should only crash if I trigger the event calling this module (clicking on the link). Is that a sensible assumption?

          – Konrad
          Nov 21 '18 at 16:30













          Well, then it seems we need to join the dark side and use observeEvent anyway. - please check my edit.

          – ismirsehregal
          Nov 21 '18 at 18:23







          Well, then it seems we need to join the dark side and use observeEvent anyway. - please check my edit.

          – ismirsehregal
          Nov 21 '18 at 18:23






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53049659%2floading-shiny-module-only-when-menu-items-is-clicked%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          'app-layout' is not a known element: how to share Component with different Modules

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          WPF add header to Image with URL pettitions [duplicate]