Skip to content

feat(sdui): standardize on_change payload to { id, value } across all renderers#463

Merged
roblevintennis merged 3 commits intomasterfrom
issue-461/on-change-payload
Mar 23, 2026
Merged

feat(sdui): standardize on_change payload to { id, value } across all renderers#463
roblevintennis merged 3 commits intomasterfrom
issue-461/on-change-payload

Conversation

@roblevintennis
Copy link
Copy Markdown
Contributor

Summary

  • All form input nodes (AgInput, AgCheckbox, AgToggle, AgRadio, AgSelect, AgSelectionButtonGroup, AgSelectionCardGroup) now dispatch { id: node.id, value: currentValue } to on_change handlers across the React, Vue, and Lit renderers
  • Consumers can accumulate questionnaire answers as answers[id] = value without parsing DOM events
  • SelectionButtonGroup/CardGroup were already passing a raw value string; this PR wraps that in the same { id, value } shape for consistency
  • SPECIFICATION.md section 5.1 updated to describe the standardized payload; new section 5.4 added with the full questionnaire integration pattern

Payload shapes by component

Component value type
AgInput string (input text)
AgSelect string | string[]
AgRadio string (radio value)
AgCheckbox boolean (checked state)
AgToggle boolean (checked state)
AgSelectionButtonGroup string (selected value)
AgSelectionCardGroup string (selected value)

Test plan

  • React renderer builds clean: cd v2/sdui/renderers/react && npm run build
  • Vue renderer builds clean: cd v2/sdui/renderers/vue && npm run build
  • Lit renderer builds clean: cd v2/sdui/renderers/lit && npm run build
  • In demo-llm or existing fixture demos, wire an on_change action and confirm the payload shape in the console
  • Existing behavior: actions without on_change continue to no-op (no regression)

Closes #461

🤖 Generated with Claude Code

… renderers

All form input nodes (AgInput, AgCheckbox, AgToggle, AgRadio, AgSelect,
AgSelectionButtonGroup, AgSelectionCardGroup) now dispatch a structured
payload { id: node.id, value: <current value> } to on_change action handlers.

This is the prerequisite for adaptive questionnaire flows (issue #461):
consumers can accumulate answers[id] = value without parsing DOM events.

Also adds SPECIFICATION.md section 5.4 documenting the questionnaire
integration pattern and updates section 5.1 to describe the standardized
payload shape.

Closes #461
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 23, 2026

Deploy Preview for agnosticui-demo-vue ready!

Name Link
🔨 Latest commit df850e5
🔍 Latest deploy log https://app.netlify.com/projects/agnosticui-demo-vue/deploys/69c180218adde4000704b9f2
😎 Deploy Preview https://deploy-preview-463--agnosticui-demo-vue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 23, 2026

Deploy Preview for agnosticui-demo-react ready!

Name Link
🔨 Latest commit df850e5
🔍 Latest deploy log https://app.netlify.com/projects/agnosticui-demo-react/deploys/69c1802162aa55000800555a
😎 Deploy Preview https://deploy-preview-463--agnosticui-demo-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 23, 2026

Deploy Preview for agnosticui-demo-lit ready!

Name Link
🔨 Latest commit df850e5
🔍 Latest deploy log https://app.netlify.com/projects/agnosticui-demo-lit/deploys/69c18021f5ff7500085ece1c
😎 Deploy Preview https://deploy-preview-463--agnosticui-demo-lit.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Add componentActionPayloadMap, vueComponentActionPayloadMap, and
litComponentActionPayloadMap to codegen.config.ts so that the codegen
emits the correct { id, value } payload for each form input component
without conflating the different event detail shapes (checked boolean
vs value string) across Checkbox, Input, Radio, Select, and Toggle.

Update codegen.ts generators to check the component-level map before
falling back to the generic actionPayloadMap.

Regenerate React and Vue renderer files to match.
Vue component wrappers type their event callbacks with specific detail
types (e.g. CheckboxChangeEventDetail), not the base Event type. Using
(e: Event) in generated Vue handlers caused TS2769 no-overload-match
errors because Event is structurally incompatible with detail types.

Changing to (e: unknown) satisfies all Vue wrapper callback signatures
and is consistent with the existing (e as unknown as {...}) casts in
vueComponentActionPayloadMap expressions.

Regenerate all three renderer files.
@roblevintennis roblevintennis merged commit 92e4156 into master Mar 23, 2026
15 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.

feat(sdui): standardize on_change payload to { id, value } across all form input components

1 participant