adobe / adobe/react-webcomponent

Default model values are passed for attributes that are not present

Đang mở
#13 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
104
Fork
20
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện kịch bản custom-element và render React đã được ghi chép, tập trung vào cách các thuộc tính của model được thu thập và truyền dưới dạng props. Hoàn thành khi một thuộc tính boolean bị bỏ qua không xuất hiện trong props của React, trong khi một thuộc tính được chỉ định rõ ràng vẫn được truyền tới render với giá trị mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, react
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.