Skip to content

Commit

Permalink
Merge pull request #37 from dustinfarris/waiter-patch-1
Browse files Browse the repository at this point in the history
Fix waiter when there is an error
  • Loading branch information
dustinfarris authored Jan 23, 2017
2 parents afebe43 + 78f3081 commit 472c56b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test-support/helpers/cashay.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ export const waitForSubscriptions = function() {
// will have to manually check cachedSubscriptions

// response could be undefined if it was flushed
if (!response || response.status !== "loading") {
if (!response || response.status !== "loading" || response.error) {
return false;
} else {
// Taking the first field, hopefully the only one
let fieldName = Object.keys(response.data)[0];
let field = response.data[fieldName];

let cachedSubscription = cashay.cachedSubscriptions[`${fieldName}::${field.id}`];
let subscriptionKey = key ? `${fieldName}::${key}` : fieldName;
let cachedSubscription = cashay.cachedSubscriptions[subscriptionKey];

if (cachedSubscription && cachedSubscription.status === "ready") {
// This is just a live query, we do not need to hold anything up
Expand Down

0 comments on commit 472c56b

Please sign in to comment.