jeudi 9 juillet 2015

ember + ember-data 1.13.5 - infinite initialize loop

I updated ember + ember-data version of existing project using these instructions, and I'm getting an infinite loop inside ember-data init process.

ember versions:

ember-cli version: 1.13.1
ember-data version: 1.13.5

the package.json and bower.json is what I got from ember-cli + some packages I installed. the inifinite loop I get is this (stack trace from chrome):

.......
ember$data$lib$system$container$proxy$$ContainerProxy.aliasedFactory.create (container-proxy.js:22)
instantiate (ember.debug.js:1446)
lookup (ember.debug.js:1313)
buildInjections (ember.debug.js:1344)
injectionsFor (ember.debug.js:1396)
factoryFor (ember.debug.js:1373)
instantiate (ember.debug.js:1415)
lookup (ember.debug.js:1313)
Container.lookup (ember.debug.js:1245)
Registry.lookup (ember.debug.js:1666)

ember$data$lib$system$container$proxy$$ContainerProxy.aliasedFactory.create (container-proxy.js:22)
instantiate (ember.debug.js:1446)
lookup (ember.debug.js:1313)
buildInjections (ember.debug.js:1344)
injectionsFor (ember.debug.js:1396)
factoryFor (ember.debug.js:1373)
instantiate (ember.debug.js:1415)
lookup (ember.debug.js:1313)
Container.lookup (ember.debug.js:1245)

ember$data$lib$instance$initializers$initialize$store$service$$initializeStoreService (initialize-store-service.js:33)
    (anonymous function) (ember.debug.js:4356)
(anonymous function) (ember.debug.js:4372)
visit (ember.debug.js:2241)
DAG.topsort (ember.debug.js:2352)
_emberRuntimeSystemNamespace.default.extend._runInitializer (ember.debug.js:4371)
_emberRuntimeSystemNamespace.default.extend.runInstanceInitializers (ember.debug.js:4354)
_emberRuntimeSystemNamespace.default.extend.didBecomeReady (ember.debug.js:4386)
Queue.invoke (ember.debug.js:903)
Queue.flush (ember.debug.js:967)
DeferredActionQueues.flush (ember.debug.js:767)
Backburner.end (ember.debug.js:160)
Backburner.run (ember.debug.js:228)
Backburner.join (ember.debug.js:263)
run.join (ember.debug.js:19526)
run.bind (ember.debug.js:19589)
jQuery.Callbacks.fire (jquery.js:3148)
jQuery.Callbacks.self.fireWith (jquery.js:3260)
jQuery.extend.ready (jquery.js:3472)
completed (jquery.js:3503)

the lookup-and-aliasedFactory.create() part repeat infinitely, with "store:main" instantiate "srvice:store" and "service:store" instantiate "store:main" from its init.

more specifically, the loop comes from the function initializeStoreService() (in file "initialize-store-service.js"), that runs container.lookup('service:store');

This invoke the 'service:store' instantiate, which at ember-debug.js calls "hash[injection.property] = lookup(container, injection.fullName);" with fullName being "store:main"... since store:main hasn't finish its init, this tries to instantiate "store:main" again which cause the infinite loop.

Is this a bug in ember? How do I fix it?

Thanks!




Aucun commentaire:

Enregistrer un commentaire