From 6c658b6ebba6eb26b4bbe8670a78541817e1d52c Mon Sep 17 00:00:00 2001 From: "Gregory R. Warnes" Date: Tue, 7 Mar 2023 16:31:14 -0500 Subject: [PATCH 1/2] When deleting drawn items, avoid error if an id is not present. --- R/modules.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/modules.R b/R/modules.R index 6bea7ba..f775abd 100644 --- a/R/modules.R +++ b/R/modules.R @@ -17,7 +17,6 @@ selectModUI <- function(id, ...) { #' @param input Shiny server function input #' @param output Shiny server function output #' @param session Shiny server function session -#' @param leafmap leaflet map to use for Selection #' @param styleFalse named \code{list} of valid \code{CSS} for non-selected features #' @param styleTrue named \code{list} of valid \code{CSS} for selected features #' @@ -184,7 +183,7 @@ editMod <- function( # now modify finished to match edited lapply(deleted$features, function(x) { loc <- match(x$properties$`_leaflet_id`, ids) - if(length(loc) > 0) { + if(!is.null(loc) && length(loc) > 0) { ids <<- ids[-loc] featurelist$finished[loc] <<- NULL } From 3660f305b63da2fec2b5b38e91e524c7e3ae8fad Mon Sep 17 00:00:00 2001 From: "Gregory R. Warnes" Date: Tue, 7 Mar 2023 16:59:13 -0500 Subject: [PATCH 2/2] Revert unintended line deletion. --- R/modules.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/modules.R b/R/modules.R index f775abd..ed8e7f8 100644 --- a/R/modules.R +++ b/R/modules.R @@ -17,6 +17,7 @@ selectModUI <- function(id, ...) { #' @param input Shiny server function input #' @param output Shiny server function output #' @param session Shiny server function session +#' @param leafmap leaflet map to use for Selection #' @param styleFalse named \code{list} of valid \code{CSS} for non-selected features #' @param styleTrue named \code{list} of valid \code{CSS} for selected features #'