adopted-ember-addons / adopted-ember-addons/ember-data-model-fragments

[question] Suggested method of getting actual changedAttributes()?

未关闭
#199 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
367
派生
108
PR 合并指标
30 天内没有已合并 PR

描述

https://github.com/lytics/ember-data-model-fragments/blob/d86b15a4eb4b216fe20a380754bc1457f8bdc352/addon/ext.js#L148

```
// An actual diff of the fragment or fragment array is outside the scope
// of this method, so just indicate that there is a change instead
```

What would be the best way (avoiding Ember private methods) to get the actual changes, or most importantly, get the original version/values of a `Fragment` or `FragmentArray`?

Calling `fragment._internalModel.changedAttributes()` _does_ give us the old and new values/states. You would still have to do diff'ing between the two manually, but at least `changedAttributes()` returns the old an new values/state.

Any suggestions? Or, is there a good reason for this behavior?

Cheers!

贡献指南

打开贡献指南

调研方向

Review addon/ext.js at line 148 and the surrounding change-tracking behavior. Compare the public APIs with fragment._internalModel.changedAttributes() to determine whether original values and actual diffs can be accessed without private methods. Done means the supported approach and its limitations are clearly documented or an agreed API change is specified.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
backend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
28/100

把新 issue 发到你的邮箱

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