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

reactive_read() now throws more informative errors #120

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Nov 16, 2023

With this change, if you try to reactive_read() a non-existant or non-trait widget attribute, you'll get an informative error. For example:

import ipyleaflet as L
from htmltools import css
from shiny import *

from shinywidgets import output_widget, reactive_read, register_widget

app_ui = ui.page_fluid(
    output_widget("map"),
    ui.output_text("foo"),
)

def server(input, output, session):

    map = L.Map(center=(52, 360), zoom=4)
    register_widget("map", map)

    @output
    @render.text
    def foo():
        reactive_read(map, "foo")


app = App(app_ui, server)
Screenshot 2023-11-16 at 3 47 27 PM

Note that this'll also improve a situation like #112, where jcharts.selections itself isn't a trait but does inherit from traitlets.HasTraits

@cpsievert cpsievert merged commit 178da20 into main Nov 17, 2023
5 checks passed
@cpsievert cpsievert deleted the reactive-read-errors branch November 17, 2023 15:24
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.

1 participant