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

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

Offen
#199 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
367
Forks
108
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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!

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
backend
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
28/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.