Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
docs
node_modules
src
# src
.babelrc
.gitignore
.npmignore
.prettierrc
rollup.config.js
yarn.lock
yarn.lock
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

if (process.env.NODE_ENV === 'production') {
module.exports = require('./lib/index.min.js');
} else {
module.exports = require('./lib/index.js');
}
// if (process.env.NODE_ENV === 'production') {
// module.exports = require('./lib/index.min.js');
// } else {
// module.exports = require('./lib/index.js');
// }
module.exports = require('./src/index.js');
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react-router-cache-route",
"version": "1.13.0",
"description": "cache-route for react-router base on react v15+ and router v4+",
"main": "index.js",
"main": "src/index.js",
"scripts": {
"build": "rollup --config"
},
Expand Down
10 changes: 5 additions & 5 deletions src/components/CacheSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ class CacheSwitch extends Switch {
}

render() {
const { children, which, autoFreeze } = this.props
const {
children,
which = element => get(element, 'type.__name') === 'CacheRoute',
autoFreeze
} = this.props
const { location, match: contextMatch } = this.getContext()

let __matchedAlready = false
Expand Down Expand Up @@ -131,8 +135,4 @@ if (isUsingNewContext) {
}
}

CacheSwitch.defaultProps = {
which: element => get(element, 'type.__name') === 'CacheRoute'
}

export default CacheSwitch