Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

load lazy models only when they have a session#78

Open
belluzj wants to merge 1 commit intogetoutreach:masterfrom
belluzj:fix-lazy-models
Open

load lazy models only when they have a session#78
belluzj wants to merge 1 commit intogetoutreach:masterfrom
belluzj:fix-lazy-models

Conversation

@belluzj
Copy link

@belluzj belluzj commented Aug 26, 2013

This fix removed lots of errors from my console, and stabilized my app.

It seems that while EPF loads json with sideloaded models, at some point models don't have a session yet but are triggered to load because of observers. Without this fix it just breaks and the lazy model is never resolved. With it, the loading eventually takes place.

@ghempton
Copy link
Contributor

Can you give an example where you hit this for context?

@belluzj
Copy link
Author

belluzj commented Aug 30, 2013

belluzj/epf_example@94f0429

If you are to clone this and launch it (on the lazy-broken branch), please also consider switching to master and try to add a new contact, with an emergency number, and, you will encounter the problem described in my other issue #61

Thanks in advance

@denisnazarov
Copy link

Thanks for this pull request, fixed a problem I was having when manually creating models from JSON with belongsTo relationships and merging them with session.merge(model). The session not existing on the belongsTo was throwing errors but this indeed fixes it.

@ghempton
Copy link
Contributor

I am going to put some more work into lazy models soon, but in the mean time I will merge this if I could get a failing test.

@belluzj
Copy link
Author

belluzj commented Feb 26, 2014

I'm sorry, I'm not working on Ember-based applications anymore, I won't be able to write tests. But you already have a whole failing application at https://github.com/belluzj/epf_example/tree/broken-lazy. (it was broken at the time, I'm not sure it still is).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants