Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router-controller

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-controller - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

71

CHANGELOG.md

@@ -0,6 +1,34 @@

## 0.1.10(2018-06-27)
### 解决 bug
- fix hot first render problem
### 更新
### 新功能
## 0.1.9(2017-12-07)
### 解决 bug
- fix preact 的热替换问题
### 更新
### 新功能
## 0.1.7(2017-10-26)
### 解决bug
### 解决 bug
- fix Controller.js中 ControllerConfig.readViewFile的firstLoad参数不正确问题
- fix Controller.js 中 ControllerConfig.readViewFile 的 firstLoad 参数不正确问题

@@ -17,3 +45,3 @@ ### 更新

### 解决bug
### 解决 bug

@@ -30,6 +58,6 @@ ### 更新

### 解决bug
### 解决 bug
- 解决viewId带“-”字符,controller中xxxView函数执行问题
eg. viewId=status-test的会执行statusTestView方法
- 解决 viewId 带“-”字符,controller 中 xxxView 函数执行问题
eg. viewId=status-test 的会执行 statusTestView 方法

@@ -46,3 +74,3 @@ ### 更新

### 解决bug
### 解决 bug

@@ -57,10 +85,10 @@

- 新增plugin功能
- 新增i18n plugin
- 新增 plugin 功能
- 新增 i18n plugin
## 0.0.9(2017-08-22)
### 解决bug
### 解决 bug
- fix 主页重定向后页面空白问题
- fix 主页重定向后页面空白问题

@@ -77,5 +105,5 @@ ### 更新

### 解决bug
### 解决 bug
- fix BrowserRouter在页面重载时,引起的多一次渲染问题
- fix BrowserRouter 在页面重载时,引起的多一次渲染问题

@@ -92,5 +120,5 @@ ### 更新

### 解决bug
### 解决 bug
- fix suffixTitle问题
- fix suffixTitle 问题

@@ -103,13 +131,13 @@ ### 更新

- 添加了同一个controller之间view可以通讯功能(之间类直接变量通讯)
- 添加了同一个 controller 之间 view 可以通讯功能(之间类直接变量通讯)
## 0.0.5(2017-08-14)
### 解决bug
### 解决 bug
- [fix run build-demo失败问题](https://github.com/dog-days/react-router-controller/commit/0c5e9ba883bd29a5c42c1fc6f7ac6942c508a538)
- [fix run build-demo 失败问题](https://github.com/dog-days/react-router-controller/commit/0c5e9ba883bd29a5c42c1fc6f7ac6942c508a538)
### 更新
- remove `<switch/>`
- remove `<switch/>`

@@ -122,3 +150,3 @@ ### 新功能

### 解决bug
### 解决 bug

@@ -133,3 +161,2 @@

- src/Controller的set方法中,readViewFile添加新参数firstLoad,用来判断当前函数,view文件是否是第一次载入。
- src/Controller 的 set 方法中,readViewFile 添加新参数 firstLoad,用来判断当前函数,view 文件是否是第一次载入。
import React from 'react';
import { hot } from 'react-hot-loader';
import Controller, { BrowserRouterController } from 'react-router-controller';

@@ -7,3 +8,2 @@ import nopage from './view/nopage';

readViewFile(viewId, controllerId, firstLoad) {
console.debug(firstLoad);
//view可以异步载入

@@ -39,11 +39,21 @@ return import(`./view/${controllerId}/${viewId}/index.jsx`).then(

export default function container(props) {
//basename的设置需要配合webpack使用,要不即使在开发环境没问题,但是成产环境
function randomKey() {
return Math.random().toString(36).substring(7).split('').join('.');
}
function container(props) {
//basename的设置需要配合webpack使用,要不即使在开发环境没问题,但是生产环境
//访问根目录的basename文件夹(文件名为basename的值),会有问题的。
let hot;
if (module.hot) {
hot = randomKey();
}
return (
<BrowserRouterController
basename={process.env.PREFIX_URL}
hot={props.hot}
basename={process.env.basename}
{...props}
hot={hot}
/>
);
}
export default hot(module)(container);

@@ -6,18 +6,5 @@ import 'react-router-controller/polyfill';

function randomKey() {
return Math.random().toString(36).substring(7).split('').join('.');
function renderApp() {
render(<Container />, document.getElementById('root'));
}
function renderApp(hot) {
render(<Container hot={hot} />, document.getElementById('root'));
}
renderApp();
if (module.hot) {
module.hot.accept('./container', () => {
//controller的热替换需要特殊处理
//通过props.hot开启,要不会不生效
//而且要用随机数处理
var hot = randomKey();
return renderApp(hot);
});
}

@@ -39,4 +39,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

basename = _props.basename,
hot = _props.hot,
preact = _props.preact;
hot = _props.hot;

@@ -46,8 +45,3 @@ return React.createElement(

this.props,
React.createElement(RouteController, {
historyType: 'browser',
basename: basename,
hot: hot,
preact: preact
})
React.createElement(RouteController, { historyType: 'browser', basename: basename, hot: hot })
);

@@ -54,0 +48,0 @@ }

@@ -39,4 +39,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

basename = _props.basename,
hot = _props.hot,
preact = _props.preact;
hot = _props.hot;

@@ -46,8 +45,3 @@ return React.createElement(

this.props,
React.createElement(RouteController, {
historyType: 'hash',
basename: basename,
hot: hot,
preact: preact
})
React.createElement(RouteController, { historyType: 'hash', basename: basename, hot: hot })
);

@@ -54,0 +48,0 @@ }

@@ -39,4 +39,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

basename = _props.basename,
hot = _props.hot,
preact = _props.preact;
hot = _props.hot;

@@ -46,8 +45,3 @@ return React.createElement(

this.props,
React.createElement(RouteController, {
historyType: 'memory',
basename: basename,
hot: hot,
preact: preact
})
React.createElement(RouteController, { historyType: 'memory', basename: basename, hot: hot })
);

@@ -54,0 +48,0 @@ }

@@ -28,4 +28,2 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

*@this { string } pathname 相当与上个页面的pathname,切换页面会变化。
*@this { boolean } hot 开启热替换,热替换跟生产环境的会有点不一样
*@this { boolean } preact preact和react的热替换有点不一样
*/

@@ -46,3 +44,3 @@ var RouteController = (_temp2 = _class = function (_React$Component) {

return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = RouteController.__proto__ || Object.getPrototypeOf(RouteController)).call.apply(_ref, [this].concat(args))), _this), _this.displayName = 'RouteController', _this.state = {}, _temp), _possibleConstructorReturn(_this, _ret);
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = RouteController.__proto__ || Object.getPrototypeOf(RouteController)).call.apply(_ref, [this].concat(args))), _this), _this.displayName = 'RouteController', _this.state = {}, _this.fristRender = true, _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -150,2 +148,5 @@

}
}, {
key: 'shouldComponentUpdate',
/**

@@ -157,15 +158,7 @@ * 这里的判断基本都是相等了才会返回通过

*/
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
//begin--热替换开启处理
var hot = nextProps.hot,
preact = nextProps.preact;
var hot = nextProps.hot;
if (hot !== this.hot) {
if (preact) {
//preact热替换跟react有点不一样
return true;
}
if (hot !== this.hot && !this.fristRender) {
//hot不相等时,不渲染上个未变化的页面

@@ -175,2 +168,3 @@ this.hot = hot;

}
this.fristRender = false;
//begin--热替换开启处理

@@ -177,0 +171,0 @@ var pathname = this.getPathNameByHistory();

@@ -52,4 +52,3 @@ 'use strict';

basename = _props.basename,
hot = _props.hot,
preact = _props.preact;
hot = _props.hot;

@@ -59,8 +58,3 @@ return _react2.default.createElement(

this.props,
_react2.default.createElement(_RouteController2.default, {
historyType: 'browser',
basename: basename,
hot: hot,
preact: preact
})
_react2.default.createElement(_RouteController2.default, { historyType: 'browser', basename: basename, hot: hot })
);

@@ -67,0 +61,0 @@ }

@@ -52,4 +52,3 @@ 'use strict';

basename = _props.basename,
hot = _props.hot,
preact = _props.preact;
hot = _props.hot;

@@ -59,8 +58,3 @@ return _react2.default.createElement(

this.props,
_react2.default.createElement(_RouteController2.default, {
historyType: 'hash',
basename: basename,
hot: hot,
preact: preact
})
_react2.default.createElement(_RouteController2.default, { historyType: 'hash', basename: basename, hot: hot })
);

@@ -67,0 +61,0 @@ }

@@ -52,4 +52,3 @@ 'use strict';

basename = _props.basename,
hot = _props.hot,
preact = _props.preact;
hot = _props.hot;

@@ -59,8 +58,3 @@ return _react2.default.createElement(

this.props,
_react2.default.createElement(_RouteController2.default, {
historyType: 'memory',
basename: basename,
hot: hot,
preact: preact
})
_react2.default.createElement(_RouteController2.default, { historyType: 'memory', basename: basename, hot: hot })
);

@@ -67,0 +61,0 @@ }

@@ -46,4 +46,2 @@ 'use strict';

*@this { string } pathname 相当与上个页面的pathname,切换页面会变化。
*@this { boolean } hot 开启热替换,热替换跟生产环境的会有点不一样
*@this { boolean } preact preact和react的热替换有点不一样
*/

@@ -64,3 +62,3 @@ var RouteController = (_temp2 = _class = function (_React$Component) {

return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = RouteController.__proto__ || Object.getPrototypeOf(RouteController)).call.apply(_ref, [this].concat(args))), _this), _this.displayName = 'RouteController', _this.state = {}, _temp), _possibleConstructorReturn(_this, _ret);
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = RouteController.__proto__ || Object.getPrototypeOf(RouteController)).call.apply(_ref, [this].concat(args))), _this), _this.displayName = 'RouteController', _this.state = {}, _this.fristRender = true, _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -168,2 +166,5 @@

}
}, {
key: 'shouldComponentUpdate',
/**

@@ -175,15 +176,7 @@ * 这里的判断基本都是相等了才会返回通过

*/
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
//begin--热替换开启处理
var hot = nextProps.hot,
preact = nextProps.preact;
var hot = nextProps.hot;
if (hot !== this.hot) {
if (preact) {
//preact热替换跟react有点不一样
return true;
}
if (hot !== this.hot && !this.fristRender) {
//hot不相等时,不渲染上个未变化的页面

@@ -193,2 +186,3 @@ this.hot = hot;

}
this.fristRender = false;
//begin--热替换开启处理

@@ -195,0 +189,0 @@ var pathname = this.getPathNameByHistory();

{
"name": "react-router-controller",
"version": "0.1.9",
"version": "0.1.10",
"description": "react-router-controller,react路由控制器",

@@ -30,9 +30,3 @@ "main": "libs/index.js",

},
"keywords": [
"react",
"router",
"controller",
"控制器",
"路由"
],
"keywords": ["react", "router", "controller", "控制器", "路由"],
"author": "xianshannan",

@@ -53,2 +47,4 @@ "license": "ISC",

"lint-staged": "^4.0.3",
"preact": "^8.2.6",
"preact-compat": "^3.17.0",
"prettier": "^1.5.3",

@@ -59,4 +55,3 @@ "prop-types": "^15.5.10",

"react-dom": "^15.6.1",
"preact": "^8.2.6",
"preact-compat": "^3.17.0",
"react-hot-loader": "^4.3.3",
"switch-demo": "0.0.1"

@@ -83,25 +78,13 @@ },

],
"plugins": [
"transform-decorators-legacy"
],
"plugins": ["transform-decorators-legacy"],
"env": {
"development": {
"plugins": [
"react-hot-loader/babel"
]
"plugins": ["react-hot-loader/babel"]
},
"default": {
"plugins": [
"transform-decorators-legacy"
],
"presets": [
"react",
"es2015",
"stage-0"
]
"plugins": ["transform-decorators-legacy"],
"presets": ["react", "es2015", "stage-0"]
},
"es": {
"plugins": [
"transform-decorators-legacy"
],
"plugins": ["transform-decorators-legacy"],
"presets": [

@@ -108,0 +91,0 @@ "react",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc