Skip to content

Commit

Permalink
Merge pull request #915 from simplabs/fix-cookie-store-regression
Browse files Browse the repository at this point in the history
Don't start syncing cookie before first restore
  • Loading branch information
marcoow committed Feb 29, 2016
2 parents 4c0a795 + df20ac5 commit 823aa9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions addon/session-stores/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember';
import BaseStore from './base';
import objectsAreEqual from '../utils/objects-are-equal';

const { RSVP, computed, on } = Ember;
const { RSVP, computed, on, run: { next } } = Ember;

/**
Session store that persists data in a cookie.
Expand Down Expand Up @@ -88,8 +88,10 @@ export default BaseStore.extend({
}).volatile(),

_setup: on('init', function() {
this._syncData().then(() => {
this._renewExpiration();
next(() => {
this._syncData().then(() => {
this._renewExpiration();
});
});
}),

Expand Down
6 changes: 4 additions & 2 deletions tests/unit/session-stores/shared/cookie-store-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ export default function(options) {
sync(store);

Ember.run.next(() => {
expect(triggered).to.be.true;
done();
Ember.run.next(() => {
expect(triggered).to.be.true;
done();
});
});
});

Expand Down

0 comments on commit 823aa9d

Please sign in to comment.