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

Cannot get property in an array of objects

未关闭
#178 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
38
派生
27
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。