adopted-ember-addons / adopted-ember-addons/validated-changeset

Cannot get property in an array of objects

Abierto
#178 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
38
Forks
27
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hello,

I'm trying to get a property in an array of objects. It seems that the changes are not retrieved properly with `.get()`. Sadly, I don't know enough about this library to identify the problem.

Also, i didn't see examples of changeset with an array of objects in the documentation. Is it recommended ?

I made a simple reproduction test that explains the problem.

```js
describe('arrays of objects', () => {
test('changes in array are gettable', () => {
let initialData = { contacts: [] };

const changeset = Changeset(initialData);

changeset.set("contacts", [{
name :'william'
}]);

// returns undefined
expect(changeset.get("contacts.0")).toStrictEqual({
name :'william'
});
expect(changeset.get("contacts.0.name")).toStrictEqual(
'william'
);
});
});
```

node version : 14.19.1
validated-changeset: 1.3.3

Thank you in advance.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.