Skip to content

Commit

Permalink
fix(Page): Fix the propType of pageId
Browse files Browse the repository at this point in the history
  • Loading branch information
tennisonchan committed Sep 12, 2018
1 parent 0485863 commit 3b6259b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/Page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import BaseComponent from '@components/Base/BaseComponent';
class Page extends BaseComponent {
static childContextTypes = {
page: PropTypes.object,
pageId: PropTypes.number,
pageId: PropTypes.string,
config: PropTypes.object,
}
};

page;

Expand All @@ -43,8 +43,8 @@ class Page extends BaseComponent {
shouldComponentUpdate(props) {
const { data: newData } = props;
const { data: oldData } = this.props;
const { mode: newMode } = (props.graph || {});
const { mode: oldMode } = (this.props.graph || {});
const { mode: newMode } = props.graph || {};
const { mode: oldMode } = this.props.graph || {};

if (newMode !== oldMode) {
this.page.changeMode(newMode);
Expand Down Expand Up @@ -75,7 +75,7 @@ class Page extends BaseComponent {

addListener = (target, eventName, handler) => {
if (typeof handler === 'function') target.on(eventName, handler);
}
};

init() {
merge(this.config, this.props, {
Expand Down Expand Up @@ -112,9 +112,7 @@ class Page extends BaseComponent {

return (
<div id={pageId} {...pick(this.props, ['style', 'className'])}>
{
page ? children : null
}
{page ? children : null}
</div>
);
}
Expand Down

0 comments on commit 3b6259b

Please sign in to comment.