shinyFeedback icon indicating copy to clipboard operation
shinyFeedback copied to clipboard

JS error when showing/hiding feedback on non existent elements

Open bartekch opened this issue 2 years ago • 0 comments

If we call hideFeedback or showFeedback* with inputId of nonexistent element, a JS error is throw like on the screen below. image

This is NOT causing any issues in Shiny app itself, so it has little importance, but I'm bringing this up anyway since it may surprise someone checking the console.

Example

library(shiny)
library(shinyFeedback)
shinyApp(
  ui = basicPage(
    shinyFeedback::useShinyFeedback(),
    actionButton("b", "Throw JS error")
  ),
  
  server = function(input, output, session) {
    observe({
      input$b
      shinyFeedback::hideFeedback("input")
      shinyFeedback::showFeedbackSuccess("input")
    })
  }
)

Checked with version https://github.com/merlinoa/shinyFeedback/commit/5cc4d16d53d8262ff1a4d67cbfeee0c88cedf60e

bartekch avatar May 04 '22 12:05 bartekch