a2ui-project / a2ui-project/a2ui

bug(lit): v0.8 interactive components missing requestUpdate after setData

Aperta
#1,023 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
component: lit renderer P2 status: needs review type: bug
Lingua principale
TypeScript
Stelle
16.4k
Fork
1.3k
Merge medio
2g 13h
PR unite (30g)
134

Descrizione

# Description

While fixing #597 (Slider value not updating) in #1022, I discovered that other v0.8 interactive components have the same latent bug: they call `processor.setData()` without `requestUpdate()`, meaning the component does not re-render after the data model is updated.

## Affected components

| Component | File | Has `requestUpdate()`? |
|---|---|---|
| `Slider` | `renderers/lit/src/0.8/ui/slider.ts` | **Yes** (fixed in #1022) |
| `MultipleChoice` | `renderers/lit/src/0.8/ui/multiple-choice.ts` | **Yes** (already had it) |
| `TextField` | `renderers/lit/src/0.8/ui/text-field.ts` | **No** |
| `DateTimeInput` | `renderers/lit/src/0.8/ui/datetime-input.ts` | **No** |
| `CheckBox` | `renderers/lit/src/0.8/ui/checkbox.ts` | **No** |

## Why it's not immediately visible

- **TextField**: The native \`\` element displays typed characters regardless of Lit re-renders, so the bug is masked. However, any *other* component or label bound to the same data path will not update.
- **CheckBox / DateTimeInput**: These would need testing to confirm visible impact.

## Suggested fix

In #1022 I added a `updateBoundData()` helper to the `Root` base class that encapsulates the `setData()` + `requestUpdate()` pattern. The affected components can be refactored to use it, the change would be minimal for each.

## Root cause

The deeper issue is that `SignalWatcher` does not pick up changes made through `SignalMap.set()` during `processor.setData()`. This might be worth investigating separately in `web_core`, but in the meantime `requestUpdate()` is a reliable workaround (and already used by `MultipleChoice`).

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.