From fb7e9743c9323317c228bb79ff398e9c764b78b0 Mon Sep 17 00:00:00 2001 From: Duc Ng Date: Tue, 1 Mar 2016 20:10:05 -0800 Subject: [PATCH 1/4] createContainer.js: added getComponent() to return the original component --- src/lib/createContainer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/createContainer.js b/src/lib/createContainer.js index 42ae0c5..5dd2826 100644 --- a/src/lib/createContainer.js +++ b/src/lib/createContainer.js @@ -84,6 +84,9 @@ module.exports = function (Component, options) { ).then(function (fetchedFragments) { return assign.apply(null, fetchedFragments); }); + }, + getComponent: function () { + return Component; } }, componentDidMount: function () { From c89f0aae8df7b7dfe9a3d89eb9bbb232025381f8 Mon Sep 17 00:00:00 2001 From: Duc Ng Date: Sat, 19 Mar 2016 23:48:38 -0700 Subject: [PATCH 2/4] updated package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f3fb92..e7ed1a0 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-transmit", + "name": "react-setup-transmit", "description": "Relay-inspired library based on Promises instead of GraphQL.", "version": "3.1.7", "license": "BSD-3-Clause", From b0681c94da77f43dbe6a832deb58a15f99943d99 Mon Sep 17 00:00:00 2001 From: Nicolas Yann Couturier Date: Wed, 25 May 2016 11:06:04 +0200 Subject: [PATCH 3/4] issue #65 - use Object.assign instead of deprecated React.__spread --- package.json | 4 ++-- src/lib/assign.js | 8 -------- src/lib/createContainer.js | 11 +++++------ src/lib/render.js | 5 ++--- src/lib/renderToString.js | 9 ++++----- 5 files changed, 13 insertions(+), 24 deletions(-) delete mode 100644 src/lib/assign.js diff --git a/package.json b/package.json index 1f3fb92..f5d475f 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "fetch-plus-json": "3.6.0", "isomorphic-fetch": "2.2.0", "json-loader": "0.5.4", - "react": "0.14.6", - "react-dom": "0.14.6", + "react": "15.1.0", + "react-dom": "15.1.0", "react-hot-loader": "1.3.0", "react-inline-css": "2.1.0", "webpack": "1.12.11", diff --git a/src/lib/assign.js b/src/lib/assign.js deleted file mode 100644 index 9a4701f..0000000 --- a/src/lib/assign.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @copyright © 2015, Rick Wong. All rights reserved. - */ -"use strict"; - -var React = require("./react"); - -module.exports = React.__spread; diff --git a/src/lib/createContainer.js b/src/lib/createContainer.js index 42ae0c5..054749d 100644 --- a/src/lib/createContainer.js +++ b/src/lib/createContainer.js @@ -6,7 +6,6 @@ var isRootContainer = require("./isRootContainer"); var promiseProxy = require("./promiseProxy"); var React = require("./react"); -var assign = require("./assign"); var assignProperty = require("./assignProperty"); /** @@ -39,7 +38,7 @@ module.exports = function (Component, options) { throw new Error(Component.displayName + " has no '" + fragmentName +"' fragment") } - variables = assign({}, Container.variables, variables || {}); + variables = Object.assign({}, Container.variables, variables || {}); var promise = Container.fragments[fragmentName](variables); @@ -82,7 +81,7 @@ module.exports = function (Component, options) { return promiseProxy.Promise.all( promises ).then(function (fetchedFragments) { - return assign.apply(null, fetchedFragments); + return Object.assign.apply(null, fetchedFragments); }); } }, @@ -128,7 +127,7 @@ module.exports = function (Component, options) { } } - assign(_this.variables, nextVariables); + Object.assign(_this.variables, nextVariables); var fetchPromise = Container.getAllFragments(_this.variables, optionalFragmentNames); fetchPromise.then(function (fetchedFragments) { @@ -233,7 +232,7 @@ module.exports = function (Component, options) { componentWillMount: function () { var externalVariables = this.props && this.props.variables || {}; - this.variables = assign({}, Container.variables, externalVariables); + this.variables = Object.assign({}, Container.variables, externalVariables); this.variables = Container.prepareVariables(this.variables); if (isRootContainer(Container)) { @@ -278,7 +277,7 @@ module.exports = function (Component, options) { return React.createElement( Component, - assign({}, props, state, {transmit: transmit}) + Object.assign({}, props, state, {transmit: transmit}) ); } }); diff --git a/src/lib/render.js b/src/lib/render.js index 94ad647..ea104f9 100644 --- a/src/lib/render.js +++ b/src/lib/render.js @@ -3,7 +3,6 @@ */ "use strict"; -var assign = require("./assign"); var isRootContainer = require("./isRootContainer"); var overrideCreateElement = require("./overrideCreateElement"); var React = require("./react"); @@ -23,13 +22,13 @@ module.exports = function (Component, props, targetDOMNode, callback) { var args = [].slice.call(arguments, 1); if (isRootContainer(type) && fetchedFragments.length) { - assign(props, fetchedFragments.pop()); + Object.assign(props, fetchedFragments.pop()); } return originalCreateElement.apply(null, args); }, function () { - assign(props, {createElement: React.createElement}); + Object.assign(props, {createElement: React.createElement}); ReactDOM.render(React.createElement(Component, props), targetDOMNode, callback); } ); diff --git a/src/lib/renderToString.js b/src/lib/renderToString.js index 6a438c1..64b3625 100644 --- a/src/lib/renderToString.js +++ b/src/lib/renderToString.js @@ -3,7 +3,6 @@ */ "use strict"; -var assign = require("./assign"); var isRootContainer = require("./isRootContainer"); var overrideCreateElement = require("./overrideCreateElement"); var promiseProxy = require("./promiseProxy"); @@ -18,7 +17,7 @@ module.exports = function (Component, props) { return new promiseProxy.Promise(function (resolve, reject) { var promises = []; - var myProps = assign({}, props); + var myProps = Object.assign({}, props); var reactString; @@ -35,7 +34,7 @@ module.exports = function (Component, props) { return originalCreateElement.apply(null, args); }, function () { - assign(myProps, {createElement: React.createElement}); + Object.assign(myProps, {createElement: React.createElement}); reactString = ReactDOM.renderToString(React.createElement(Component, myProps)); } ); @@ -53,13 +52,13 @@ module.exports = function (Component, props) { var args = [].slice.call(arguments, 1); if (isRootContainer(type) && fetchedFragments.length) { - assign(props, fetchedFragments.pop()); + Object.assign(props, fetchedFragments.pop()); } return originalCreateElement.apply(null, args); }, function () { - assign(myProps, {createElement: React.createElement}); + Object.assign(myProps, {createElement: React.createElement}); reactString = ReactDOM.renderToString(React.createElement(Component, myProps)); } ); From 8c599a0fcfdca3ec3297f0a1dca6cd3e28e722a2 Mon Sep 17 00:00:00 2001 From: ngduc Date: Mon, 19 Sep 2016 10:05:35 -0700 Subject: [PATCH 4/4] chore: increased minor version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e357db8..a78761b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-setup-transmit", "description": "Relay-inspired library based on Promises instead of GraphQL.", - "version": "3.1.7", + "version": "3.1.8", "license": "BSD-3-Clause", "repository": { "type": "git",