christianalfoni / flux-angular

Use the FLUX architecture with Angular JS
313 stars 50 forks source link

safedeepcopy issue when object has length property #40

Closed nozer closed 9 years ago

nozer commented 9 years ago

Hi

If you return the following variable from an export function in a store, you will see that you get lots of undefined in vars property.

var obj = {
    a: {
      x: 1,
      vars: [
        {b:2, length:30}, 
        {c:3, length:20}]
    }
  };

Problem is because of the length property in the vars array objects.

Here is the related line for this problem in safeDeepCopy

// Handle Array - or array-like items
if (obj instanceof Array || obj.length) {

I changed it to this to fix my current problem

if (angular.isArray(obj)) { //obj instanceof Array || obj.length) {

A fix would be greatly appreciated!

Nihat

christianalfoni commented 9 years ago

Hi @nozer,

Ah, yes, this should be fixed. Let me push out a new version

nozer commented 9 years ago

Thanks!

christianalfoni commented 9 years ago

@nozer ,

So sorry for the delay, someone interrupted me at work and this totally got lost on me. I have pushed a new version now!

nozer commented 9 years ago

No need to apologize at all. Thank you for the great product and I do appreciate all the work you do!

christianalfoni commented 9 years ago

;-)

nozer commented 9 years ago

Did you push this properly? We updated to the new version via bower and fix did not work. I noticed that in the release folder, fix was not applied. Did you forget to do something in your work flow to push those changes in full?

christianalfoni commented 9 years ago

Hi again @nozer ,

Give it a try now! I have to build myself a deploy script or something. Updating bower, package, deploying etc. There are not many steps, but enough for me to forget one ;-)

christianalfoni commented 9 years ago

I take it that it worked :-)