Coder Social home page Coder Social logo

Comments (5)

dgeb avatar dgeb commented on August 28, 2024

I think checking path.length has been a naive approach. It would probably be better to check the contents of path[2] to verify whether a link or attribute is being updated. There is similar logic in some orbit sources that should be improved as well.

from ember-orbit.

tute avatar tute commented on August 28, 2024

Interesting. I tried something like that, and it did propagate the didTransform properly, but the array still was being changed in very weird ways until resulting in a number (losing the other values), probably because of other places where there's similar logic.

I'll keep your comment in mind for an upcoming PR.

from ember-orbit.

dgeb avatar dgeb commented on August 28, 2024

@tute Looking at this in more detail, it appears that you must be trying to patch within an attribute that's an array. If you were simply replacing an attribute whose value is an array, then path.length would still be 3.

I'm going to close this for now, since I don't plan to support patching embedded arrays or objects, except as a whole. Of course, I'm open to discussion of why Orbit might want to support micro-patches of embedded data as opposed to normalizing the embedded data out into separate models and relationships. Please let me know your use case if you want to pursue this. Thanks!

from ember-orbit.

tute avatar tute commented on August 28, 2024

Sounds good @dgeb, thanks for your work! Your idea of a model object that takes care of updating the array/object argument makes a lot of sense and works great!

from ember-orbit.

dgeb avatar dgeb commented on August 28, 2024

@tute ok, cool - thanks for confirming that this approach will work for you!

from ember-orbit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.