adopted-ember-addons / adopted-ember-addons/ember-cp-validations
Presence validation on belongsTo relationship stopped working on 3.11.
- 主要语言
- JavaScript
- 星标
- 439
- 派生
- 172
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Environment
- Ember Version: 3.11.1
- Ember CLI Version: 3.11.0
- Ember CP Validations Version: 4.0.0-beta.9
### Steps to Reproduce
After I upgraded from ember 3.10 to 3.11 the presence validations on belongsTo relationships stopped working. Looks like it does not detect that the associated record has changed and displays `This field can't be blank` even when record is well assigned.
After I ran `notifyPropertyChange` on that property the validations get updated and works correctly.
This is how my model looks like:
```javascript
import attr from 'ember-data/attr';
import Model from 'ember-data/model';
import { belongsTo } from 'ember-data/relationships';
import { buildValidations, validator } from 'ember-cp-validations';
const Validations = buildValidations({
title: [
validator('presence', true)
],
author: [
validator('presence', true)
]
});
export default Model.extend(Validations, {
title: attr('string'),
author: belongsTo()
});
```
贡献指南
调研方向
Start from the shown JavaScript model and reproduce the belongsTo presence-validation case on Ember 3.11.1 with ember-cp-validations 4.0.0-beta.9, comparing it with Ember 3.10. Trace how assignment updates validation state versus the manual notifyPropertyChange path. Done means an assigned author no longer shows “This field can't be blank” without manual notification.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100