adopted-ember-addons / adopted-ember-addons/ember-paper
Paper Select 'required' behaviour doesn't work when 'selected' is set to an empty promise
- 主要语言
- JavaScript
- 星标
- 879
- 派生
- 327
- PR 合并指标
- 30 天内没有已合并 PR
描述
A `{{paper-select}}` component in a `{{paper-form}}` and bound to a `belongsTo` relationship does not behave correctly when `required=true`, if the relationship is empty and the `selected` property is set to the related model. For example, if `selected=model.otherModel` when there is no associated `otherModel`. The reason seems to be that when there isn't a related model, `model.otherModel` is equal to an Ember Data PromiseObject whose `content` is `null`, instead of `model.otherModel` actually being `null` itself.
The result is that the `*` to indicate that the field is required doesn't appear, and the form passes validation even when no value is selected. The correct behaviour can be obtained by setting `selected=(if model.otherModel.id model.otherModel)` so that `selected` is `null` when the other model is missing.
I've created a [demo repo](https://github.com/mikeu/paper-select-related-null) that reproduces the issue.
贡献指南
调研方向
Start by running the linked demo repo and reproducing the case with paper-select inside paper-form, required=true, and an empty belongsTo relationship. Then trace how paper-select interprets selected when it is an Ember Data PromiseObject with null content. Done means the required marker appears and form validation fails when no related model is selected.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100