adopted-ember-addons / adopted-ember-addons/validated-changeset
Snapshot changes is wrong when object has proxy attributes
- 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ả
Hi, changeset of ED Models with async belongsTo relationships show incorrect changes on snapshot:

`change` and `changes` are correct, but `snapshot().changes` shows all my async belongsTo as changed attributes incorrectly.
I think this is because of this unrwrap https://github.com/validated-changeset/validated-changeset/blob/da68651a41028ab827872cf10960920779c2a09f/src/index.ts#L975
Which adds all the unwrapped relationships to `this[CHANGES]`. When i get `change` and `changes` these incorrect changes are filtered out, but not on snapshot.
Does my explanation make sense? Thanks in advance!
EDIT:
If anyone else comes here looking for a solution I'm currently creating snapshots like this until it is fixed
```js
function createSnapshot(cs) {
const changes = {};
cs.changes.forEach(({ key, value }) => { changes[key] = value; });
return {
changes,
errors: { ...cs.error },
};
}
```
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á.