Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Merge pull request #62 from kadirahq/fix-hot-reloading
Browse files Browse the repository at this point in the history
Fix issue where hot reloaded updates were not rendered
  • Loading branch information
roonyh authored Oct 13, 2016
2 parents f9e96a5 + 5246e30 commit c90dcbc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions dist/components/WrapStory.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ var WrapStory = function (_React$Component) {
// Set knobs in the panel for the first time.
this.setPaneKnobs();
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
this.setState({ storyContent: props.initialContent });
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function select(name, options, value) {
}

function date(name) {
var value = arguments.length <= 1 || arguments[1] === undefined ? new Date() : arguments[1];
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();

var proxyValue = value ? value.getTime() : null;
return manager.knob(name, { type: 'date', value: proxyValue });
Expand Down
4 changes: 4 additions & 0 deletions src/components/WrapStory.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export default class WrapStory extends React.Component {
this.setPaneKnobs();
}

componentWillReceiveProps(props) {
this.setState({ storyContent: props.initialContent });
}

componentWillUnmount() {
this.props.channel.removeListener('addon:knobs:knobChange', this.knobChanged);
this.props.channel.removeListener('addon:knobs:reset', this.resetKnobs);
Expand Down

0 comments on commit c90dcbc

Please sign in to comment.