Skip to content

Fix 868 869#1239

Merged
ColinFay merged 4 commits intoThinkR-open:temp-devfrom
ilyaZar:fix-868-869
Apr 20, 2026
Merged

Fix 868 869#1239
ColinFay merged 4 commits intoThinkR-open:temp-devfrom
ilyaZar:fix-868-869

Conversation

@ilyaZar
Copy link
Copy Markdown
Contributor

@ilyaZar ilyaZar commented Apr 17, 2026

Fix #869

Fix #869

To verify, generate a fresh golex witrh create_golem and thenb

  1. generate the binding files
    run this in the Console:
  golem::add_js_input_binding("custom", open = FALSE)
  golem::add_js_output_binding("custom", open = FALSE)

this should create:

  - inst/app/www/custom-input.js
  - inst/app/www/custom-output.js
  - R/fct_custom_input_binding.R
  - R/fct_custom_output_binding.R
  1. rplace R/app_ui.R with this
    You only need to change the fluidPage(...) part:
  app_ui <- function(request) {
    tagList(
      golem_add_external_resources(),
      fluidPage(
        customInput("myCustom", "Enter something:", value = "Hello"),
        actionButton("set_custom", "Set from server"),
        tags$hr(),
        verbatimTextOutput("echo"),
        tags$hr(),
        customOutput("custom_out")
      )
    )
  }
  1. replace R/app_server.R with this
  app_server <- function(input, output, session) {
    observeEvent(input$set_custom, {
      updateCustomInput(
        session,
        "myCustom",
        label = "Updated label",
        value = "Updated from server"
      )
    })

    output$echo <- renderPrint({
      input$myCustom
    })

    output$custom_out <- renderCustom({
      paste(
        "Output binding says:",
        if (is.null(input$myCustom)) "" else input$myCustom
      )
    })
  }
  1. run the app
    In RStudio, do one of these:

docuemt_and_reload(), and or build pkg

then run run_app()

  1. wehen the app opens you should see:
  • a text input labeled Enter something:
  • its initial value should be Hello
  • a button Set from server
  • a verbatimTextOutput showing "Hello"
  • a custom output showing Output binding says: Hello
  1. type into the text input:
  • the verbatimTextOutput should update as you type
  • the custom output should also update as you type

click Set from server:

  • the input label should change to Updated label
  • the input value should change to Updated from server
  • both outputs should update accordingly

@ColinFay ColinFay changed the base branch from master to temp-dev April 20, 2026 06:33
@ColinFay ColinFay merged commit 70f8ea7 into ThinkR-open:temp-dev Apr 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rework golem::add_js_output_binding

2 participants