diff --git a/src/index.js b/src/index.js
index 81d8184a74a4..2c559a63a5a5 100644
--- a/src/index.js
+++ b/src/index.js
@@ -18,6 +18,7 @@ function register() {
}
let knobStore = {};
+const stories = {};
function createKnob(name, value, type) {
if (knobStore[name]) {
@@ -30,12 +31,20 @@ function createKnob(name, value, type) {
function wrap(storyFn) {
const channel = addons.getChannel();
- const localKnobStore = {};
return context => {
+ if (!stories[context.kind]) {
+ stories[context.kind] = {};
+ }
+
+ if (!stories[context.kind][context.story]) {
+ stories[context.kind][context.story] = {};
+ }
+
// Change the global knobStore to the one local to this story
- knobStore = localKnobStore;
- return ;
+ knobStore = stories[context.kind][context.story];
+
+ return ;
};
}
diff --git a/src/stories/Button.js b/src/stories/Button.js
index 0c9af5a67424..25645c7aadfc 100644
--- a/src/stories/Button.js
+++ b/src/stories/Button.js
@@ -11,7 +11,7 @@ const buttonStyles = {
const Button = ({ onClick, style, color, width, children, disabled }) => (