From 33a43a792b4f04b0139635c9a96a31cbf4f9ada6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Sat, 2 May 2020 13:10:37 +0200
Subject: [PATCH] Replace conf2rv_conf with lst2rv_lst

* R/shiny-ui-base.R(conf2rv_conf,lst2rv_lst): Replace conf2rv_conf
  with lst2rv_lst which is more general and able to work out
  recursively what needs to be change into a reactive values list.
---
 R/shiny-ui-base.R | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/R/shiny-ui-base.R b/R/shiny-ui-base.R
index 3a0b2f8..a7f7db4 100644
--- a/R/shiny-ui-base.R
+++ b/R/shiny-ui-base.R
@@ -96,12 +96,8 @@ rv_lst2lst <- function(rv) {
         rv else lapply(shiny::reactiveValuesToList(rv),rv_lst2lst)
 }
 
-conf2rv_conf <- function(conf,rv) {
-    rv$conf <- shiny::reactiveValues(project=conf$project,
-                                     data=conf$data,
-                                     compounds=shiny::reactiveValues(known=conf$compounds$known,
-                                                                     unknown=conf$compounds$unknown,
-                                                                     setid=conf$compounds$setid))
-    rv
-    
+lst2rv_lst <- function(lst) {
+    ## Take nested named list and create reactive values from it.
+    if (class(lst) != "list")
+        lst else do.call(react_v,lapply(lst,lst2rv_lst))
 }
-- 
GitLab