a2ui-project / a2ui-project/a2ui

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

Ouverte Adaptée aux débutants
#1,023 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
component: lit renderer P2 status: needs review type: bug
Langage dominant
TypeScript
Étoiles
16.4k
Forks
1.3k
Merge moyen
2 j 13 h
PR mergées (30 j)
134

Description

# 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`).

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

The issue lists the affected component files in `renderers/lit/src/0.8/ui/`. Examine the `TextField`, `DateTimeInput`, and `CheckBox` components to see where `processor.setData()` is called. Use the `updateBoundData()` helper from the `Root` base class (as introduced in PR #1022) to replace those calls, ensuring each is followed by `requestUpdate()`. Test the changes by running any existing tests for these components or by manually verifying the UI updates correctly.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
typescript
Domaine
frontend, web-dev
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Calme
Clarté
Clairement spécifiée
Accessibilité débutants
70/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.