You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest version of ember stable (not yet tagged but already available using components/ember#release and will be released in 1.13.6) includes a bugfix in some memory leaks.
One of the fixes consists in unregister test helpers when the app is destroyed. However this causes an error in invalidateSession when you have an afterEach hook like this:
It turns out that invalidateSession is asynchronous (BTW, why?) the destruction of the app is synchronous because happens inside an Ember.run, so by the time the session is invalidated the wait() helper is not available anymore.
Doing Ember.run(invalidateSession); worked for me, although @stefanpenner suggested to chain the invalidation of the session like this:
It's a bit verbose but I'm ok with it if it has to be done that way, as long as it's explained in the documentation.
I'd also like to know why the invalidation of the session is async, because perhaps the helper can be run-loop aware and allow to keep being used without chaining.
The text was updated successfully, but these errors were encountered:
invalidateSession asynchronous because the underlying authenticator implementation might be asynchronous. When you're using the ephemeral session store you shouldn't need the invalidateSession call at all though as every time the application restarts you'll have a new session with a clean store.
Coming from here: emberjs/ember.js#11864 (comment)
tl; dr;
The latest version of ember stable (not yet tagged but already available using
components/ember#release
and will be released in 1.13.6) includes a bugfix in some memory leaks.One of the fixes consists in unregister test helpers when the app is destroyed. However this causes an error in
invalidateSession
when you have anafterEach
hook like this:It turns out that
invalidateSession
is asynchronous (BTW, why?) the destruction of the app is synchronous because happens inside anEmber.run
, so by the time the session is invalidated thewait()
helper is not available anymore.Doing
Ember.run(invalidateSession);
worked for me, although @stefanpenner suggested to chain the invalidation of the session like this:invalidateSession().then(() => Ember.run(application, 'destroy'))
It's a bit verbose but I'm ok with it if it has to be done that way, as long as it's explained in the documentation.
I'd also like to know why the invalidation of the session is async, because perhaps the helper can be run-loop aware and allow to keep being used without chaining.
The text was updated successfully, but these errors were encountered: