Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.16 breaks state data inheritance #2631

Closed
hackel opened this issue Mar 18, 2016 · 5 comments
Closed

0.2.16 breaks state data inheritance #2631

hackel opened this issue Mar 18, 2016 · 5 comments
Labels

Comments

@hackel
Copy link

hackel commented Mar 18, 2016

I believe this is a result of: $state: make state data inheritance prototypical (c4fec8c).

In my code, I use data.hasOwnProperty(someVar) to check whether a requested value exists. The switch to prototypical inheritance breaks this check and causes a lot of breakage on my site. This is a major breaking change, thereby necessitating a 0.3.x version! I've been able to fix this by simply changing my checks to someVar in data, but it took quite a bit of debug time to isolate the cause of the failure.

@eddiemonge
Copy link
Contributor

You are probably right about this being a breaking change. It might be hard to roll it back now though since there have been a few version releases since then and most effort is going towards 1.0

@christopherthielen thoughts?

@paol
Copy link

paol commented Jun 22, 2016

We recently tried to upgrade from 0.2.15 to 0.2.18 and ran into this problem. In our case we are iterating over the data object with angular.foreach(), which misses the inherited properties. It is indeed a breaking change.

@christopherthielen
Copy link
Contributor

Unfortunately the cat is out of the bag. I've noted this as a BC in the 1.0 upgrade notes.

@motin
Copy link

motin commented Feb 8, 2017

I came here from a google search on the subject, so for other users searching for more information on the subject including @christopherthielen's polyfill to get the old behavior back, read this: http://stackoverflow.com/questions/38676633/angular-ui-router-child-of-abstract-state-not-inheriting-data-in-statechanges/42107929#42107929

@christopherthielen
Copy link
Contributor

@motin thanks for the nice writeup on the StackOverflow question.

I've updated the plunker demonstrating how to merge data on the child with the data on the parent: http://plnkr.co/edit/Wm9p13QRkxCjRKOwVvbQ?p=preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants