Skip to content

Can the modules exported by {login} be used inside other modules? #9

@teofiln

Description

@teofiln

I am calling login_ui/new_user_ui and login_server inside another module (login_page) that is the called by the main app server. And the inputs are unresponsive.

When I call the login functions on the top level of my application (i.e., in app_server, not at a lower level in login_page, things seem to be working.

Makes me think that there is some issue with the namespacing.

Here is an example to reproduce the isse:

library(shiny)
library(login)

# --- Login Module ---
mod_login_ui <- function(id) {
    ns <- NS(id)
    tagList(
        login_ui(ns("login")),
        new_user_ui(ns("login"))
    )
}

mod_login_server <- function(id) {
    moduleServer(id, function(input, output, session) {
        login_server(
            "login",
            db_conn = RSQLite::dbConnect(RSQLite::SQLite(), ":memory:")
        )
    })
}

# --- App ---
ui <- fluidPage(
    mod_login_ui("auth")
)

server <- function(input, output, session) {
    mod_login_server("auth")
}

shinyApp(ui, server)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions