Giter Club home page Giter Club logo

Comments (3)

rchl avatar rchl commented on July 22, 2024

Changing from merge to extend would probably be backwards-incompatible change and potentially even dangerous if there are existing users that depend on merging strategy right now, no? It should probably be configurable either from the set call or globally but default to current behavior.

from dynogels.

aneilbaboo avatar aneilbaboo commented on July 22, 2024

That's a legitimate worry. However, the current behavior is a bug. So perhaps there's a path to fixing this:

  1. Add a property mergeWhenSettingObjectAttributes to the dynogels top level which sets an internal property
  2. Add a conditional warning:
    • if this value is undefined, and use the default _.merge behavior:

    "Warning: Please explicitly set mergeWhenSettingObjectAttributes. see https:\\github.com\clarkie\dynogels\issues\174 for details. Current default behavior of Item.set, when value is an object, is to merge the new object with the existing object. In a future major release, this will change to overwrite. Use dynogels.mergeWhenSettingsObjectAttributes=false for overwrite behavior. Set to true for merge behavior."

    • else If value is set to falsey, use _.extend,
    • else value is truthy, so use _.merge.
  3. On next major version bump, switch the behavior to _.extend.

from dynogels.

zolaemil avatar zolaemil commented on July 22, 2024

Unexpected as it is, it seems like the behaviour is by design, because Item.prototype.update uses Item.prototype.set

self.set(item.attrs);

from dynogels.

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.