From db65444b8c4696f02fd56c69c603aaa207ed866b Mon Sep 17 00:00:00 2001 From: Mauro Masiero Date: Wed, 20 Mar 2024 10:52:38 +0100 Subject: [PATCH 1/2] add shinyalert to test conflicts with wizard steps for/backwards --- inst/app/app-dev.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inst/app/app-dev.R b/inst/app/app-dev.R index 8603030..b3ccd88 100644 --- a/inst/app/app-dev.R +++ b/inst/app/app-dev.R @@ -15,6 +15,7 @@ ui <- fluidPage( theme = bslib::bs_theme(version = 5L), # add button actionButton("show_wizard", "Show wizard"), + actionButton("show_shinyalert", "Show shinyalert"), wizard( modal = TRUE, lock_start = TRUE, @@ -106,6 +107,14 @@ server <- function(input, output, session) { print("reset wizard") wizardR::reset("my_modal") }) + + observeEvent(input$show_shinyalert, { + shinyalert::shinyalert( + title = "Hello", + text = "This is a shinyalert", + type = "success" + ) + }) } shinyApp(ui, server) From db51b0722f4cb0a4cefdd4e04f3794d75890cf45 Mon Sep 17 00:00:00 2001 From: Mauro Masiero Date: Thu, 21 Mar 2024 14:09:38 +0100 Subject: [PATCH 2/2] fix wizard re-initialization with shinyalert --- inst/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/inst/main.js b/inst/main.js index 65d1838..7f14df3 100644 --- a/inst/main.js +++ b/inst/main.js @@ -11,10 +11,18 @@ $.extend(wizard, { let args = $(el).data("configuration"); + // check if wizard is initialized, return if yes + //TODO debug why shinyalert is causing the wizard to re-initialize + if ($(el).data("wizard")) { + return; + } + + const wizard = new Wizard(args); wizard.init(); + // expose wizard.lock function this.lock = function() { wizard.lock(); @@ -58,6 +66,7 @@ $.extend(wizard, { } else if (msg === "reset") { this.reset(); } + //TODO understand why message show is not being received // else if (msg.type === "show") { // var modal = bootstrap.Modal.getOrCreateInstance( // document.getElementById('wizard-modal-' + el.id), {}