Skip to content
This repository has been archived by the owner on Jan 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #134 from samsel/master
Browse files Browse the repository at this point in the history
[release] v3.1.0
  • Loading branch information
samsel committed Jan 26, 2016
2 parents bdee60c + ac4bd80 commit 849bf6b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 3.1.0 (Jan 25 2016)

* fix - set implicit extension to import file names
* fix - Allow consumers to override history object
* Use path instead of pathname to ensure querystring is not stripped - https://github.com/paypal/react-engine/pull/131
* Client-side error when using code splitting in webpack - https://github.com/paypal/react-engine/pull/129

## 3.0.0 (Jan 10 2016)

* [v3.x] - support react-router@1 and react@0.14

## 2.6.2 (Jan 3 2016)

* fix - lodash-node package is deprecated(https://github.com/paypal/react-engine/issues/122)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ document.addEventListener('DOMContentLoaded', function onLoad() {
// `onBoot` - Function (optional)
// returns data that was used
// during rendering as the first argument
// the second argument is the `router` created behind the scenes
// the second argument is the `history` object that was created behind the scenes
// (only available while using react-router)
client.boot(/* client options object */, function onBoot(data, router) {
client.boot(/* client options object */, function onBoot(data, history) {

});
};
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"history": "^1.17.0",
"json-loader": "^0.5.4",
"react": "^0.14.3",
"react-engine": "3.0.0-rc.2",
"react-engine": "^3.0.0",
"react-router": "^1.0.3",
"serve-favicon": "^2.3.0",
"webpack": "^1.12.9"
Expand Down
18 changes: 9 additions & 9 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

'use strict';

var Config = require('./config');
var Config = require('./config.json');
var ReactRouter = require('react-router');
var RouterComponent = ReactRouter.Router;
var match = ReactRouter.match;
var routerHistory = require('history');
var createHistory = require('history').createHistory;
var ReactDOM = require('react-dom');
var merge = require('lodash/object/merge');

Expand Down Expand Up @@ -53,14 +53,13 @@ exports.boot = function boot(options, callback) {
}

var router;

var history;
var location;
var viewResolver = options.viewResolver;

// pick up the state that was injected by server during rendering
var props = _window[Config.client.variableName];

var useRouter = (props.__meta.view === null);

var mountNode = options.mountNode || _document;

if (useRouter) {
Expand All @@ -69,8 +68,9 @@ exports.boot = function boot(options, callback) {
throw new Error('asking to use react router for rendering, but no routes are provided');
}

var windowLocation = window.location;
var location = windowLocation.pathname + windowLocation.search + windowLocation.hash;
history = createHistory();
location = _window.location.pathname +
_window.location.search + _window.location.hash;

// Wrap the 'render' function within a call to 'match'. This is a workaround to support
// users using code splitting functionality
Expand All @@ -84,7 +84,7 @@ exports.boot = function boot(options, callback) {
},

routes: options.routes,
history: routerHistory.createHistory()
history: history
});

ReactDOM.render(routerComponent, mountNode);
Expand All @@ -104,5 +104,5 @@ exports.boot = function boot(options, callback) {
}

// call the callback with the data that was used for rendering
return callback && callback(props, router);
return callback && callback(props, history);
};
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
var path = require('path');
var util = require('./util');
var assert = require('assert');
var Config = require('./config');
var Config = require('./config.json');
var ReactDOMServer = require('react-dom/server');
var debug = require('debug')(require('../package').name);
var ReactRouterServerErrors = require('./reactRouterServerErrors');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-engine",
"version": "3.0.0",
"version": "3.1.0",
"description": "a composite render engine for express apps to render both plain react views and react-router views",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 849bf6b

Please # to comment.