adopted-ember-addons / adopted-ember-addons/ember-cp-validations

Presence validation on belongsTo relationship stopped working on 3.11.

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

Mô tả

### 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()
});
```

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

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

Hướng nghiên cứu

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.

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
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
35/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.