GithubHelp home page GithubHelp logo

Comments (8)

rtfeldman avatar rtfeldman commented on July 20, 2024

Thanks for bringing this up!

Unfortunately, there would be a significant performance cost to enabling this; merge would have to keep track of whether any modifications had been made, and inspect every current value before merging along the way.

I don't think the performance overhead is worth making this work.

from seamless-immutable.

tusharmath avatar tusharmath commented on July 20, 2024

This is a little wierd because u see —

var obj = Immutable({
  a: {aa: 1},
  b: {bb: 2}
})
var obj2 = obj.merge({b: {bb: 2}}, {deep: true})

console.log(obj.b === obj2.b, obj.a === obj2.a) // actually returns true for both cases.

So you are doing a check here right? I can get the same behavior by just wrapping the whole object inside another temp object.

from seamless-immutable.

rtfeldman avatar rtfeldman commented on July 20, 2024

Hm, sure enough! It looks like we're already doing this and incurring the performance cost, so I guess it's empirically not a performance problem. 😆 My bad!

I'll look into this.

from seamless-immutable.

rtfeldman avatar rtfeldman commented on July 20, 2024

Fixed and published as 4.0.2. Thanks for reporting this @tusharmath, and sorry I didn't look far enough into it the first time around!

from seamless-immutable.

tusharmath avatar tusharmath commented on July 20, 2024

@rtfeldman No need for sorry. Thanks a ton for fixing it so quickly.

from seamless-immutable.

zuk avatar zuk commented on July 20, 2024

Looks like this is still happening for objects with nested arrays. For example:

var a = Immutable({foo: []})
var b = Immutable({foo: []})
var ab = a.merge(b, {deep: true})
ab === a  // => false

Without a nested array it works as expected:

var a = Immutable({foo: {}})
var b = Immutable({foo: {}})
var ab = a.merge(b, {deep: true})
ab === a  // => true

from seamless-immutable.

rtfeldman avatar rtfeldman commented on July 20, 2024

@zuk can you open a separate issue for that?

from seamless-immutable.

zuk avatar zuk commented on July 20, 2024

Sure, opened it as #94

from seamless-immutable.

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.