Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaurav0 committed Nov 9, 2019
1 parent cd47e7a commit 7bebc15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/store/addon/-private/system/core-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2245,7 +2245,7 @@ abstract class CoreStore extends Service {
if (options.reload !== false) {
if (
(adapter.shouldReloadAll && adapter.shouldReloadAll(this, snapshotArray)) ||
(!adapter.shouldReloadAll && snapshotArray.length > 0)
(!adapter.shouldReloadAll && snapshotArray.length === 0)
) {
set(array, 'isUpdating', true);
return promiseArray(_findAll(adapter, this, modelName, options));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module('integration/reload - Reloading Tests', function(hooks) {
await this.store.findAll('person', { reload: true });

assert.equal(this.adapter.shouldReloadAllCalled, 0, 'shouldReloadAll is not called');
assert.equal(this.adapter.requestsMade, 1, 'an ajaz request is made');
assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made');
});

test('store.findAll does not error if adapter.shouldReloadAll is not defined (records are present)', async function(assert) {
Expand All @@ -129,7 +129,7 @@ module('integration/reload - Reloading Tests', function(hooks) {

await this.store.findAll('person');

assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made');
assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made');
});

test('store.findAll does not error if adapter.shouldReloadAll is not defined (records are absent)', async function(assert) {
Expand All @@ -139,7 +139,7 @@ module('integration/reload - Reloading Tests', function(hooks) {

await this.store.findAll('person');

assert.equal(this.adapter.requestsMade, 0, 'no ajax request is made');
assert.equal(this.adapter.requestsMade, 1, 'an ajax request is made');
});

test('adapter.shouldReloadAll is called when store.findAll is called without a reload flag (shouldReloadAll is false)', async function(assert) {
Expand Down

0 comments on commit 7bebc15

Please sign in to comment.