You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(shiny)
library(shiny.fluent)
# Define the UI for the login moduleloginPageUI<-function(id) {
ns<- NS(id)
div(
id=id,
div(
class="login-box",
PrimaryButton.shinyInput(ns("login_btn"), text="Sign in")
),
reactOutput(ns("messageBar"))
)
}
# Define the server logic for the login moduleloginPageServer<-function(id, user_session) {
moduleServer(id, function(input, output, session) {
ns<-session$nsmessageBarUI<- reactiveVal(NULL)
observeEvent(input$login_btn, {
user_session$logged<-TRUEuser_session$page_name<-"firstPage"
messageBarUI(
MessageBar("Message")
)
})
output$messageBar<- renderReact({
messageBarUI()
})
return(user_session)
})
}
# Define the UI for the firstPage modulefirstPageUI<-function(id) {
ns<- NS(id)
div(
id=id,
DefaultButton.shinyInput(ns("showDialog"), text="Open dialog"),
reactOutput(ns("reactDialog"))
)
}
# Define the server logic for the firstPage modulefirstPageServer<-function(id, user_session) {
moduleServer(id, function(input, output, session) {
ns<-session$nsisDialogOpen<- reactiveVal(FALSE)
output$reactDialog<- renderReact({
dialogContentProps<-list(
type=0,
title="Missing Subject",
closeButtonAriaLabel="Close",
subText="Do you want to send this message without a subject?"
)
Dialog(
hidden=!isDialogOpen(),
onDismiss= JS(paste0(
"function() {",
" Shiny.setInputValue('", ns("hideDialog"),"', Math.random());",
"}"
)),
dialogContentProps=dialogContentProps,
modalProps=list()
)
})
observeEvent(input$showDialog, isDialogOpen(TRUE))
observeEvent(input$hideDialog, isDialogOpen(FALSE))
})
}
# Main UIui<- fluentPage(
div(
class="grid-container",
div(class="main", reactOutput("main"))
)
)
# Main server logicserver<-function(input, output, session) {
user_session<- reactiveValues(
logged=FALSE, page_name="login"
)
is_login_page<- reactive({
user_session$page_name=="login"
})
output$main<- renderReact({
if (is_login_page()) {
loginPageUI("login")
} else {
firstPageUI("firstPage")
}
})
user_session<- loginPageServer("login", user_session)
firstPageServer("firstPage", user_session)
}
# Run the application
shinyApp(ui, server)
Bug description
In the above code, we expect the Dialog should pop out a Modal window when user clicked the Open dialog button, but it failed to render in html
in the browser console,
After few rounds of trial-and-error, we found the loginPageUI div structure triggered this bug, but the underlying issues remained unknown. Please see below for our current workaround.
Expected behavior
As mentioned, the Dialog in firstPageUI module should works as normal.
We found a workaround for this issue, we can replace the loginPageUI with following code:
# Define the UI for the login moduleloginPageUI<-function(id) {
ns<- NS(id)
div(
id=id,
div(
class="login-box",
PrimaryButton.shinyInput(ns("login_btn"), text="Sign in")
),
div(reactOutput(ns("messageBar"))) # workaround is wrapping reactOutput with div
)
}
Although this workaround is good, but we hope the team can fix this issue, as it is frustrated and very tricky for newcomers and this may blocked them to use this amazing package!
Comments
No response
The text was updated successfully, but these errors were encountered:
Code example
Bug description
In the above code, we expect the
Dialog
should pop out a Modal window when user clicked theOpen dialog
button, but it failed to render in htmlin the browser console,
![image](https://private-user-images.githubusercontent.com/51594799/336290100-c49476f2-4ab6-4454-8c47-68f0a7e36f13.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2Nzk1ODksIm5iZiI6MTcyNTY3OTI4OSwicGF0aCI6Ii81MTU5NDc5OS8zMzYyOTAxMDAtYzQ5NDc2ZjItNGFiNi00NDU0LThjNDctNjhmMGE3ZTM2ZjEzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA3VDAzMjEyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIxMDhmZTMyNzY2NzM4NzNkZGJiMjJjNTY4ZmY5ZjJjN2Q0MmE1OGRkNDY0NzkyMGFkNzI5ZjJmMTBjNjZhNjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.YFkjRAmXO8v-gkkZ5rk4ZIcpWgKXe1kESCkPVxZBJIA)
After few rounds of trial-and-error, we found the
loginPageUI
div structure triggered this bug, but the underlying issues remained unknown. Please see below for our current workaround.Expected behavior
As mentioned, the
Dialog
infirstPageUI
module should works as normal.We found a workaround for this issue, we can replace the
loginPageUI
with following code:Although this workaround is good, but we hope the team can fix this issue, as it is frustrated and very tricky for newcomers and this may blocked them to use this amazing package!
Comments
No response
The text was updated successfully, but these errors were encountered: