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

@tracked on a property does not allow that property to be reverted via unexecute

Đang mở
#207 0 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ả

If the object passed into changeset has a property marked with `@tracked` this causes the property
not to be able to be reverted with the `unexecute` method.

This is because in the `mergeDeep` the method [`mergeTargetAndSource`](https://github.com/adopted-ember-addons/validated-changeset/blob/main/src/utils/merge-deep.ts#L87) is called. In that method,
the test for `propertyIsUnsafe` is true because the `@tracked` used `defineProperty` to create the property
which is by default not enumerable and fails the test in [`propertyIsUnsafe`](https://github.com/adopted-ember-addons/validated-changeset/blob/main/src/utils/merge-deep.ts#L47). Not exactly sure what this unsafe
test is guarding against. Since the property is unsafe, it continues on to the code to [`buildPathToValue`](https://github.com/adopted-ember-addons/validated-changeset/blob/main/src/utils/merge-deep.ts#L93) which
yields no valid paths for the property, so the old value is not reassigned.

Had the `@tracked` property been defined as enumerable, the code would have considered it a safe continued on to one of
the sets at line [113](https://github.com/adopted-ember-addons/validated-changeset/blob/main/src/utils/merge-deep.ts#L113), [121](https://github.com/adopted-ember-addons/validated-changeset/blob/main/src/utils/merge-deep.ts#121), or [124](https://github.com/adopted-ember-addons/validated-changeset/blob/main/src/utils/merge-deep.ts#L124)

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.