if (isEmpty(contact) || isEmpty(get(contact, 'emails'))) {
contact = yield store.findRecord('contact', contactId);
}
if (isEmpty(contact) || isEmpty(get(contact, 'emails'))) {
flashMessages.danger(i18n.t('email.cpq_document_email_missing'));
return false;
}
The second block runs when the promise is running and Im getting an error. Shouldn't it stop the flow until the promise is resolved.
The promise runs fine and it works the next time
Assuming you are using ember-data
, you may be encountering a case where findRecord
returns a cached record. This depends on if you've already loaded the record (perhaps from a previous findRecord
, findAll
or query
on another route, and how the ember-data
adapter is configured: shouldBackgroundReloadRecord
and shouldBackgroundReloadAll
are methods on the adapter that default to returning true
. When those methods return true
, the cached record is immediately returned, but the record(s) are fetched again in the "background".