react-collider
Advanced tools
Comparing version
@@ -18,3 +18,3 @@ 'use strict'; | ||
var defaultOptions = { | ||
once: false, | ||
once: true, | ||
forceFetch: false, | ||
@@ -21,0 +21,0 @@ set: false |
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _parseurl = require('parseurl'); | ||
var parseurl = _interopRequire(_parseurl); | ||
var _React = require('react'); | ||
@@ -57,13 +53,5 @@ | ||
var originalUrl = parseurl.original(req), | ||
reqPath = parseurl(req).pathname, | ||
hasTrailingSlash = originalUrl.pathname[originalUrl.pathname.length - 1] === '/'; | ||
var perfInstance = performance(req.url); | ||
if (reqPath === '/' && !hasTrailingSlash) { | ||
reqPath = ''; | ||
} | ||
var perfInstance = performance(reqPath); | ||
collider(routes, reqPath, fetchHandler, function (Handler, data) { | ||
collider(routes, req.url, fetchHandler, function (Handler, data) { | ||
returnResponse(res, Handler, data, perfInstance); | ||
@@ -70,0 +58,0 @@ }); |
{ | ||
"name": "react-collider", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"description": "Express middleware for isomorphic express + react apps", | ||
@@ -17,3 +17,2 @@ "main": "index.js", | ||
"bluebird": "^2.9.21", | ||
"parseurl": "^1.3.0", | ||
"ramda": "^0.13.0", | ||
@@ -20,0 +19,0 @@ "react": "^0.13.1", |
@@ -127,3 +127,3 @@ # React-collider [](http://travis-ci.org/dailymotion/react-collider) | ||
- `options` Object. Available options: | ||
- `once`: Removes the data from the local variable after use. This means the next time you call the same data it will fetch them remotely. Default to false. | ||
- `once`: Removes the data from the local variable after use. This means the next time you call the same data it will fetch them remotely. Default to true. | ||
- `forceFetch`: Fetches the data remotely even if the data are available locally. Default to false. | ||
@@ -130,0 +130,0 @@ - `set`: Sets the data locally after fetching them remotely. The next time you need them they will be taken locally (unless you use the `forceFetch` option). Default to false. |
@@ -1,2 +0,1 @@ | ||
import parseurl from 'parseurl' | ||
import React from'react' | ||
@@ -32,13 +31,5 @@ import Router from 'react-router' | ||
var originalUrl = parseurl.original(req), | ||
reqPath = parseurl(req).pathname, | ||
hasTrailingSlash = originalUrl.pathname[originalUrl.pathname.length - 1] === '/' | ||
var perfInstance = performance(req.url) | ||
if (reqPath === '/' && !hasTrailingSlash) { | ||
reqPath = '' | ||
} | ||
var perfInstance = performance(reqPath) | ||
collider(routes, reqPath, fetchHandler, function(Handler, data) { | ||
collider(routes, req.url, fetchHandler, function(Handler, data) { | ||
returnResponse(res, Handler, data, perfInstance) | ||
@@ -45,0 +36,0 @@ }) |
@@ -15,11 +15,7 @@ var React = require('react'), | ||
}, | ||
// componentWillMount: function() { | ||
// this.setState({video: this.props.data.Video}) | ||
// }, | ||
// getVideoTitle: function() { | ||
// return this.state.video ? this.state.video : '' | ||
// }, | ||
render: function() { | ||
return ( | ||
React.createElement('div', null) | ||
React.createElement('div', null, | ||
React.createElement('div', null, this.props.data.User) | ||
) | ||
) | ||
@@ -26,0 +22,0 @@ } |
@@ -19,12 +19,6 @@ var React = require('react'), | ||
}, | ||
componentWillMount: function() { | ||
this.setState({video: this.props.data.Video}) | ||
}, | ||
getVideoTitle: function() { | ||
return this.state.video ? this.state.video : '' | ||
}, | ||
render: function() { | ||
return ( | ||
React.createElement('div', null, | ||
React.createElement('h1', null, this.getVideoTitle()) | ||
React.createElement('h1', null, this.props.data.video) | ||
) | ||
@@ -31,0 +25,0 @@ ) |
@@ -66,2 +66,12 @@ var expect = require('chai').expect, | ||
}) | ||
it('should get the params from the router', function(done) { | ||
request(server) | ||
.get('/user/2121') | ||
.expect(200) | ||
.expect(function(res) { | ||
expect(res.text).to.have.string('2121') | ||
}) | ||
.end(done) | ||
}) | ||
}) | ||
@@ -68,0 +78,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
-16.67%1
-50%37966
-1.96%833
-1.88%- Removed
- Removed