From e6380461089f2bf487eb14e842afe09420919142 Mon Sep 17 00:00:00 2001 From: Dony Unardi Date: Wed, 2 Apr 2025 21:53:44 -0700 Subject: [PATCH] recompute live-search in updateoptionalselectinput --- NEWS.md | 3 ++- R/optionalInput.R | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 09d1f264..329b2f60 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,10 @@ # teal.widgets 0.4.3.9001 ### Breaking changes - * `panel_group()` and `panel_item()` are deprecated. Please use the `bslib::accordion()` and `bslib::accordion_panel()` instead. +### Bug fixes +* Recompute the `live-search` option value dynamically in `updateOptionalSelectInput` (#291) # teal.widgets 0.4.3 diff --git a/R/optionalInput.R b/R/optionalInput.R index c4305ce9..a930684b 100644 --- a/R/optionalInput.R +++ b/R/optionalInput.R @@ -302,7 +302,10 @@ updateOptionalSelectInput <- function(session, # nolint label = label, selected = as.character(raw_selected), choices = raw_choices, - choicesOpt = picker_options(choices) + choicesOpt = picker_options(choices), + options = list( + `live-search` = ifelse(length(raw_choices) > 10, TRUE, FALSE) + ) ) invisible(NULL)