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

Cannot get property in an array of objects

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

Mô tả

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.

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

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.