Skip to content

Commit

Permalink
Only use query string when input exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonthegeek committed Nov 23, 2023
1 parent 7a091d5 commit 860b84e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 0 additions & 4 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
#' @keywords internal
.app_server <- function(input, output, session) {
# Set up input row.
cli::cli_inform("Setting up input row.")
slack_user_info <- .user_server()
timezone <- .timezone_server()
selected_book <- .book_server()

cli::cli_inform("Loading signups.")
signups <- reactive({
.load_book_signups(selected_book())
})

# I need to sort out the reactivity to make this its own module. For now this
# works and other attempts didn't.
cli::cli_inform("Setting up calendar observer.")
observe({
req(
timezone(),
Expand All @@ -32,7 +29,6 @@
)
})

cli::cli_inform("Setting up submit observer.")
observeEvent(
input$submit,
.submit_availability(
Expand Down
10 changes: 7 additions & 3 deletions R/book.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@
query_book <- book_choices[book_choices == query$bookname]
})

# Only use the query_string to update the input when the app initially
# loads. After that, the input is the source of truth.
# Only use the query_string to update the input when the app initially loads
# AND THE UI INCLUDES THE INPUT. After that, the input is the source of
# truth.
observeEvent(
query_book(),
{
if (length(query_book()) && query_book() != input$selected_book) {
if (
length(query_book()) && length(input$selected_book) &&
query_book() != input$selected_book
) {
updateSelectInput( # nocov start (can't find a way to automate)
session,
"selected_book",
Expand Down

0 comments on commit 860b84e

Please sign in to comment.