Skip to content

Commit

Permalink
use internalModel promise if already loading
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Aug 8, 2018
1 parent 9ebd2fe commit 65a0b0b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@ export default class BelongsToRelationship extends Relationship {
}

function proxyRecord(internalModel) {
return resolve(internalModel).then(resolvedInternalModel => {
let promise = internalModel;
if (internalModel && internalModel.isLoading()) {
promise = internalModel._promiseProxy;
}

return resolve(promise).then(resolvedInternalModel => {
return resolvedInternalModel ? resolvedInternalModel.getRecord() : null;
});
}
Expand Down

0 comments on commit 65a0b0b

Please sign in to comment.