From 5246e309cca35c020f4d1a74a5a061b4ff4425b5 Mon Sep 17 00:00:00 2001 From: Aruna Herath Date: Thu, 13 Oct 2016 19:51:38 +0530 Subject: [PATCH] Fix issue where hot reloaded updates were not rendered --- dist/components/WrapStory.js | 5 +++++ dist/index.js | 2 +- src/components/WrapStory.js | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dist/components/WrapStory.js b/dist/components/WrapStory.js index 9fab057..e5ce257 100644 --- a/dist/components/WrapStory.js +++ b/dist/components/WrapStory.js @@ -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() { diff --git a/dist/index.js b/dist/index.js index c1e33ef..03b8ec5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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 }); diff --git a/src/components/WrapStory.js b/src/components/WrapStory.js index fc2e93b..9df5da7 100644 --- a/src/components/WrapStory.js +++ b/src/components/WrapStory.js @@ -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);