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

Returning an Object from computed property can loose data binding. #10539

Closed
raytiley opened this issue Feb 26, 2015 · 4 comments · Fixed by #10721
Closed

Returning an Object from computed property can loose data binding. #10539

raytiley opened this issue Feb 26, 2015 · 4 comments · Fixed by #10721

Comments

@raytiley
Copy link
Contributor

This is a little bit weird, but basically In my app I'm returning the result of a ember data find from a computed property, and use the PromiseProxy flag isPending to show a loading spinner. When the route first loads this works fine.

On subsequent returns from the computed property the object is returned correctly (you can see this by the ember id increasing in my jsbins) but the isPending properties are never updated.

If I stash the promise on window and inspect it manually int he console isPending is changing, its just not reflected in the rendered output of the app.

Hope this makes sense.

Broken on Canary: http://emberjs.jsbin.com/repoqi/1/edit?html,output
Working on 1.9.1: http://emberjs.jsbin.com/zewule/1/edit?html,js,output

@stefanpenner
Copy link
Member

seems like a regression.

@raytiley
Copy link
Contributor Author

Playing around more with this looks like this commit is when it broke: 8714aba
(http://emberjs.jsbin.com/repoqi/3/edit?js,output)

The previous commit works as expected:
baa2c22
(http://emberjs.jsbin.com/bexevi/1/edit?js,output)

I'm basing this on travis builds on master since that is the only way I know to get builds I can throw in JSbin.

I'm willing to put sometime to figure this out if anyone can point me in the right direction.

@rwjblue
Copy link
Member

rwjblue commented Feb 26, 2015

This was caused by the changes in #10494.

@wycats / @tomdale - Does this ring a bell?

@raytiley raytiley changed the title Returning PromiseProxy object from computed property can loose databinding. Returning an Object from computed property can loose data binding. Mar 2, 2015
@raytiley
Copy link
Contributor Author

raytiley commented Mar 2, 2015

So this is my EmberConf project, to understand and hopefully fix this. Turns out its more pervasive than I originally thought. Returning a regular Ember.Object from a computed property will cause any data binding on that object to be lost.

http://emberjs.jsbin.com/yahobu/2/edit?html,js,output

raytiley added a commit to raytiley/ember.js that referenced this issue Mar 3, 2015
This recreates emberjs#10539 in a unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants