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

Presence validation on belongsTo relationship stopped working on 3.11.

Aberta
#651 6 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
439
Forks
172
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript
Domínio
frontend
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.