Skip to content

Commit

Permalink
allow evaluate null
Browse files Browse the repository at this point in the history
  • Loading branch information
nbenn committed Oct 23, 2024
1 parent d55b882 commit 400f640
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions R/block-core.R
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,18 @@ generate_code.call <- function(x) {
#' @inherit new_block
#' @param ... For generic consistency.
#' @export
evaluate_block <- function(x, ...) {
evaluate_block <- function(x, data, ...) {

if (!missing(data) && is.null(data)) {
return(NULL)
}

UseMethod("evaluate_block")
}

#' @rdname evaluate_block
#' @export
evaluate_block.data_block <- function(x, ...) {
evaluate_block.data_block <- function(x, data, ...) {

stopifnot(...length() == 0L)

Expand Down
4 changes: 2 additions & 2 deletions R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ generate_server_block <- function(
{
if (!is_valid$block) {
NULL
} else if (is.null(in_dat()) && !inherits(x, "transform_block")) {
} else if (inherits(x, "dataset_block")) {
evaluate_block(blk())
} else {
evaluate_block(blk(), data = in_dat())
Expand All @@ -226,7 +226,7 @@ generate_server_block <- function(
reactive({
if (!is_valid$block) {
NULL
} else if (is.null(in_dat()) && !inherits(x, "transform_block")) {
} else if (inherits(x, "dataset_block")) {
evaluate_block(blk())
} else {
evaluate_block(blk(), data = in_dat())
Expand Down

0 comments on commit 400f640

Please sign in to comment.