diff --git a/DESCRIPTION b/DESCRIPTION index af7fd2ec..17a9a04c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rhino Title: A Framework for Enterprise Shiny Applications -Version: 1.3.1.9001 +Version: 1.3.1.9002 Authors@R: c( person("Kamil", "Żyła", role = c("aut", "cre"), email = "opensource+kamil@appsilon.com"), diff --git a/NEWS.md b/NEWS.md index 9fb3dec1..c5cafc15 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ 2. Add E2E tests for the Rhino package (internal). 3. Add support for using React in Rhino (tutorial, JS function `registerReactComponents()`, R function `react_component()`). +4. Require box v1.3.1 or later (fixes issues with lazy-loaded data and trailing commas). # [rhino 1.3.1](https://github.com/Appsilon/rhino/releases/tag/v1.3.1) diff --git a/R/app.R b/R/app.R index 4561939d..a7b19d55 100644 --- a/R/app.R +++ b/R/app.R @@ -6,12 +6,6 @@ setup_box_path <- function() { } } -# Make it possible to reload the app without restarting the R session. -purge_box_cache <- function() { - loaded_mods <- loadNamespace("box")$loaded_mods - rm(list = ls(loaded_mods), envir = loaded_mods) -} - configure_logger <- function() { config <- config::get() log_level <- config$rhino_log_level @@ -126,7 +120,7 @@ with_head_tags <- function(ui) { #' @export app <- function() { setup_box_path() - purge_box_cache() + box::purge_cache() configure_logger() shiny::addResourcePath("static", fs::path_wd("app", "static")) diff --git a/R/tools.R b/R/tools.R index 120f78fa..d96e1ce1 100644 --- a/R/tools.R +++ b/R/tools.R @@ -11,7 +11,7 @@ #' } #' @export test_r <- function() { - purge_box_cache() + box::purge_cache() testthat::test_dir(fs::path("tests", "testthat")) } diff --git a/vignettes/explanation/box-modules.Rmd b/vignettes/explanation/box-modules.Rmd index 127bad38..efe9a5b4 100644 --- a/vignettes/explanation/box-modules.Rmd +++ b/vignettes/explanation/box-modules.Rmd @@ -34,12 +34,12 @@ Introduction of box to existing apps written without it has helped to improve the code structure and find bugs. # Usage -The best place to learn about box is its official [documentation](https://klmr.me/box/). +The best place to learn about box is its official [documentation](https://klmr.me/box/). The discussion here will mainly focus on how to use box inside Rhino. Rhino suggests the use of [`app/logic` and `app/view`](https://appsilon.github.io/rhino/articles/explanation/application-structure.html). -Rhino creates these directories by default. -Code that is independent of Shiny should be kept in `app/logic` +Rhino creates these directories by default. +Code that is independent of Shiny should be kept in `app/logic` while code using or related to Shiny modules should be kept in `app/view`. This structure makes it easy to make a nested hierarchy of code with the help of box. @@ -106,7 +106,7 @@ server <- function(id) { ``` -With explicit attaching of function names, it is clear from above that the code +With explicit attaching of function names, it is clear from above that the code uses `shiny.semantic::textInput()` and not `shiny::textInput()`. ```r @@ -189,19 +189,20 @@ box::use( # Known issues +The following issues were fixed in box v1.1.3, which is required by Rhino starting with v1.4.0. +This section is left here for reference. + ### Lazy-loaded data -The following issue is fixed in box v1.1.3. Rhino v1.4.0 requires box v1.1.3 or later -Box 1.1.0 doesn't support lazy-loaded [data](https://r-pkgs.org/data.html#data-data), -so e.g. `box::use(datasets[mtcars])` won't work. -This feature should be available in the next release + +Prior to v1.1.3 box didn't support lazy-loaded [data](https://r-pkgs.org/data.html#data-data), +so e.g. `box::use(datasets[mtcars])` wouldn't work (see this [issue](https://github.com/klmr/box/issues/219)). -For now please use `datasets::mtcars` in your code. +It was possible to workaround it by using `datasets::mtcars` instead. ### Trailing commas -Box 1.1.0 allows trailing commas in `box::use()` statements and code, -but they can cause problems in some circumstances: + +Box allows trailing commas in `box::use()` statements and code, +but prior to v1.1.3 they could cause problems in some circumstances: 1. Reexports ([issue](https://github.com/klmr/box/issues/263)). 2. Functions accessed via `$` ([issue](https://github.com/klmr/box/issues/266)). - -Both issues should be fixed in the nearest release.