Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Moved 1 then() handler into getAllQueries().
Browse files Browse the repository at this point in the history
  • Loading branch information
RickWong committed Mar 28, 2015
1 parent 61d3301 commit 89a58ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-transmit",
"description": "Relay-inspired library based on Promises instead of GraphQL.",
"version": "2.2.0",
"version": "2.2.1",
"license": "BSD-3",
"repository": {
"type": "git",
Expand Down
23 changes: 13 additions & 10 deletions src/lib/createContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ module.exports = function (Component, options) {
promises.push(Promise.resolve(true));
}

return Promise.all(promises);
return Promise.all(promises).
then(function (promisedQueries) {
var queryResults = {};

promisedQueries.forEach(function (promisedQuery) {
if (typeof promisedQuery === "object") {
assign(queryResults, promisedQuery);
}
});

return queryResults;
});
}
},
componentWillMount: function () {
Expand All @@ -72,15 +83,7 @@ module.exports = function (Component, options) {
assign(_this.currentParams, nextParams);

Container.getAllQueries(_this.currentParams).
then(function (promisedQueries) {
var queryResults = {};

promisedQueries.forEach(function (promisedQuery) {
if (typeof promisedQuery === "object") {
assign(queryResults, promisedQuery);
}
});

then(function (queryResults) {
try {
_this.setState(queryResults);
}
Expand Down

0 comments on commit 89a58ab

Please sign in to comment.