adopted-ember-addons / ember-changeset

Ember.js flavored changesets, inspired by Ecto
http://bit.ly/ember-changeset-demo
MIT License
431 stars 141 forks source link

[WIP] Rewrite to use native Proxy #627

Closed BryanCrotaz closed 2 years ago

BryanCrotaz commented 2 years ago

Work in progress. Using existing test suite plus some more edge cases and preserving public API.

Enables developer to use normal JS semantics:

var output = changeset.gruffalos.lastObject.say('grrr');
changeset.people[1].name.first = 'Bryan';

Really useful for having nested components:

{{#let (changeset this.model) as |changeset|}}
  {{#each changeset.people as | person |}}
    <PersonForm @model={{person}}/>
  {{/each}}
{{/let}}

PersonForm doesn't have to know that this is a changeset. The save and rollback can be at a higher level.

NullVoxPopuli commented 2 years ago

So, I like where this is going, but the real implementation is here: https://github.com/validated-changeset/validated-changeset is there a reason you opted to only update this library? or is there a PR I'm missing? :thinking:

BryanCrotaz commented 2 years ago

I didn't realise. But looking at it, validated-changeset is supposed to be independent of Ember. So it shouldn't use Tracking for example. I don't think it's possible to pull tracking out of my design. I was aiming for a really clean and simple design that gets rid of a ton of cruft.

NullVoxPopuli commented 2 years ago

validated-changeset is supposed to be independent of Ember

is true -- but it's also where most of the complexity comes in.

is the goal to eliminate the need for validated-changeset?

and fwiw, I think it is possible to a better native proxy design with validated-changeset and provide deep reactivity as well -- but, I want to make sure I know what your goals are?

BryanCrotaz commented 2 years ago

My goals are to have ember-changes et working for deep nesting without get and set. If that means submitting to validated- changeset instead then that's fine by me

NullVoxPopuli commented 2 years ago

Ah ok, we can probably do even less work then. Thanks for clarifying!

BryanCrotaz commented 2 years ago

closing in favour of https://github.com/validated-changeset/validated-changeset/pull/150