Skip to content

Fix cards example: fold select side-effects into reactiveProxy setters#39

Open
khusmann wants to merge 1 commit into
mainfrom
fix/cards-example-one-channel
Open

Fix cards example: fold select side-effects into reactiveProxy setters#39
khusmann wants to merge 1 commit into
mainfrom
fix/cards-example-one-channel

Conversation

@khusmann

Copy link
Copy Markdown
Owner

Problem

The Dynamic Column Cards example (examples/cards.R) errored at render:

change is claimed by both a value binding (value/checked) and an explicit on* handler on the same element.

Both <select> elements bound value = and attached an onChange handler. irid enforces one channel per DOM event (see enforce_one_channel_per_event in R/process_tags.R): a change event is either bound or handled, never both.

Fix

Fold each select's onChange side-effects into the set of a reactiveProxy, which is the framework's idiom for running a synchronous side-effect on write:

  • Dataset select: the setter writes dataset_name and resets selected_columns/choice.
  • Add-a-column select: the setter appends the chosen column to selected_columns and always snaps choice back to "" (the placeholder), replacing the old event$value read with the incoming value.

Verification

Launched the app and confirmed the page renders with no one-channel error.

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