Skip to content

Commit ec26194

Browse files
committed
Use modify_if() so we don't lose the attributes
1 parent e2671cc commit ec26194

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

R/cases.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ delete_orphaned_cases <- function(cases = collect_orphaned_cases()) {
140140
walk(paths, file.remove)
141141
}
142142

143+
# It is brittle to keep `pkg_path` in attributes. Maybe change to an
144+
# R6 object?
143145
cases <- function(x, pkg_path, deps = NULL) {
144146
structure(x,
145147
class = "cases",

R/shiny-server.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ vdiffrServer <- function(cases) {
33
shiny::shinyServer(function(input, output, session) {
44
cases <- shiny::reactiveValues(all = cases)
55
cases$active <- shiny::reactive({
6+
stopifnot(is_string(attr(cases$all, "pkg_path")))
67
type <- input$type %||% "new_case"
78
filter_cases(cases$all, type)
89
})
@@ -177,7 +178,7 @@ validateGroupCases <- function(input, reactive_cases, session) {
177178

178179
withdraw_cases(active_cases)
179180
idx <- purrr::map_lgl(cases, inherits, type)
180-
cases <- purrr::map_if(cases, idx, success_case)
181+
cases <- purrr::modify_if(cases, idx, success_case)
181182

182183
shiny::isolate(reactive_cases$all <- cases)
183184
}

0 commit comments

Comments
 (0)