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

Presence validation on belongsTo relationship stopped working on 3.11.

Ouverte
#651 6 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
439
Forks
172
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
frontend
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.