Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TealData checks #1406

Merged
merged 24 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a24a453
Remove TealData checks
llrs-roche Nov 11, 2024
126cbbf
Convert server usage of dataset to an error.
llrs-roche Nov 11, 2024
f16851d
Notification about module(server) no longer accepting datasets.
llrs-roche Nov 11, 2024
2161502
Update NEWS.md
llrs-roche Nov 11, 2024
59a06ca
Remove modules checks for datasets
llrs-roche Nov 11, 2024
b8c38c9
Merge branch 'main' into 1386_deprecate
m7pr Nov 11, 2024
5d3e89e
Remove tests related to parameters datasets
llrs-roche Nov 11, 2024
22ca011
Merge branch 'main' into 1386_deprecate
m7pr Nov 11, 2024
a1645ec
Merge branch '1386_deprecate' of https://github.com/insightsengineeri…
llrs-roche Nov 11, 2024
6fd1a37
Module's ui functions are only checked to have the id parameter.
llrs-roche Nov 12, 2024
98832cc
Update NEWS.md
llrs-roche Nov 13, 2024
34cda3c
Undo before merging: Test fix setup-r-dependencies
llrs-roche Nov 13, 2024
4b53c28
Merge branch '1386_deprecate' of https://github.com/insightsengineeri…
llrs-roche Nov 13, 2024
69ac901
Avoid issue with two @ on github actions.
llrs-roche Nov 13, 2024
36940bd
Temporary: Always use the r.pkg.template branch that has the fix for …
llrs-roche Nov 13, 2024
6ccaf17
Temporary: Testing again with two @
llrs-roche Nov 13, 2024
1a14f63
Temporary: test action with hash instead of branch name
llrs-roche Nov 13, 2024
6ad436e
Revert temporary changes after setup-r-dependencies was fixed
llrs-roche Nov 14, 2024
13ab296
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Nov 14, 2024
dee8f41
Bring back messages on datasets now as errors and tests adjusting for…
llrs-roche Nov 14, 2024
cb291d8
Merge branch '1386_deprecate' of https://github.com/insightsengineeri…
llrs-roche Nov 14, 2024
288598e
Update R/modules.R
llrs-roche Nov 14, 2024
6555991
Revert some changes
llrs-roche Nov 15, 2024
2d1080a
Revert from warning to stop for ui formals as requested.
llrs-roche Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
`datanames` one should modify `module$datanames`.
* The `landing_popup_module()` needs to be passed as the `landing_popup` argument of `init` instead of being passed as a module of the `modules` argument of `init`.
* `teal` no longer re-export `%>%`. Please load `library(magrittr)` instead or use `|>` from `base`.
* `module(server)` parameter does not accept the `datasets` argument.
llrs-roche marked this conversation as resolved.
Show resolved Hide resolved

### Enhancement

Expand Down
10 changes: 0 additions & 10 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ init <- function(data,

# argument checking (independent)
## `data`
if (inherits(data, "TealData")) {
lifecycle::deprecate_stop(
when = "0.15.0",
what = "init(data)",
paste(
"TealData is no longer supported. Use teal_data() instead.",
"Please follow migration instructions https://github.com/insightsengineering/teal/discussions/988."
)
)
}
checkmate::assert_multi_class(data, c("teal_data", "teal_data_module"))
checkmate::assert_class(landing_popup, "teal_module_landing", null.ok = TRUE)

Expand Down
18 changes: 0 additions & 18 deletions R/modules.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,6 @@ module <- function(label = "module",
"\n - `...` server_args elements will be passed to the module named argument or to the `...`"
)
}
if ("datasets" %in% server_formals) {
warning(
sprintf("Called from module(label = \"%s\", ...)\n ", label),
"`datasets` argument in the server is deprecated and will be removed in the next release. ",
"Please use `data` instead.",
call. = FALSE
)
}


## UI
checkmate::assert_function(ui)
Expand All @@ -217,15 +208,6 @@ module <- function(label = "module",
"\n - `...` ui_args elements will be passed to the module argument of the same name or to the `...`"
)
}
if (any(c("data", "datasets") %in% ui_formals)) {
stop(
sprintf("Called from module(label = \"%s\", ...)\n ", label),
"UI with `data` or `datasets` argument is no longer accepted.\n ",
"If some UI inputs depend on data, please move the logic to your server instead.\n ",
"Possible solutions are renderUI() or updateXyzInput() functions."
)
}


## `filters`
if (!missing(filters)) {
Expand Down
20 changes: 0 additions & 20 deletions tests/testthat/test-module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -915,26 +915,6 @@ testthat::describe("srv_teal teal_modules", {
)
})

testthat::it("srv_teal_module.teal_module passes (deprecated) datasets to the server module", {
testthat::expect_warning(
shiny::testServer(
app = srv_teal,
args = list(
id = "test",
data = teal.data::teal_data(iris = iris, mtcars = mtcars),
modules = modules(
module("module_1", server = function(id, datasets) datasets)
)
),
expr = {
session$setInputs(`teal_modules-active_tab` = "module_1")
testthat::expect_s3_class(modules_output$module_1(), "FilteredData")
}
),
"`datasets` argument in the server is deprecated and will be removed in the next release"
)
})

testthat::it("srv_teal_module.teal_module passes server_args to the ...", {
shiny::testServer(
app = srv_teal,
Expand Down
13 changes: 0 additions & 13 deletions tests/testthat/test-modules.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ testthat::test_that("module requires label argument to be a string different tha
testthat::expect_error(module(label = "global_filters"), "is reserved in teal")
})

testthat::test_that("module warns when server contains datasets argument", {
testthat::expect_warning(
module(server = function(id, datasets) NULL),
"`datasets` argument in the server is deprecated"
)
})


testthat::test_that("module expects server being a shiny server module with any argument", {
testthat::expect_no_error(module(server = function(id) NULL))

Expand Down Expand Up @@ -78,11 +70,6 @@ testthat::test_that("module requires ui_args argument to be a list", {
testthat::expect_error(module(ui_args = list(1, 2, 3)), "Must have names")
})

testthat::test_that("module throws when ui has data or datasets argument", {
testthat::expect_error(module(ui = function(id, data) NULL))
testthat::expect_error(module(ui = function(id, datasets) NULL))
})

testthat::test_that("module expects ui being a shiny ui module with any argument", {
testthat::expect_no_error(module(ui = function(id) NULL))
testthat::expect_no_error(module(ui = function(id, any_argument) NULL))
Expand Down
Loading