adobe / adobe/react-webcomponent

Default model values are passed for attributes that are not present

Offen
#13 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
104
Forks
20
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Expected Behaviour

If I have defined a model where I specify a boolean attribute. e.g. `@byBooleanAttrVal() checked`. And, I have an instance of my web component where I do not specify that attribute (e.g. . The props passed to my React components `render` method contain the `checked` prop set to the default value from the model definition.

### Actual Behaviour

I would expect any model attributes that are not specified to not be passed as props. Otherwise, I have no way of telling whether the user set that attribute or not.

### Reproduce Scenario (including but not limited to)

I was wrapping up a React implemented checkbox widget.

#### Steps to Reproduce

1. Create a React component that takes a boolean prop
2. Create a model for that component that uses `@byBooleanAttrVal()`
3. Instantiate the web component without using the boolean attribute from your model
4. Set a breakpoint in the `render` method of your React component
5. Look at the props and see that the boolean prop has been passed in

#### Platform and Version

Chrome 72

#### Sample Code that illustrates the problem

#### Logs taken while reproducing problem

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, das dokumentierte custom-element- und React-Render-Szenario zu reproduzieren, und konzentriere dich darauf, wie model-Attribute gesammelt und als props übergeben werden. Als erledigt gilt dies, wenn ein weggelassenes boolesches Attribut in den React props fehlt, während ein ausdrücklich angegebenes Attribut weiterhin mit seinem erwarteten Wert den Render erreicht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, react
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.