From 5d9601bc1cce3c9521b9b632d3dc55a6c6eef122 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Wed, 19 Jul 2017 16:42:42 -0700 Subject: [PATCH 1/3] Undo channel stubbing - causes NPM version errors to fail silently --- lib/addons/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/addons/src/index.js b/lib/addons/src/index.js index 0b2bbfeb83cc..f1169d27cd92 100644 --- a/lib/addons/src/index.js +++ b/lib/addons/src/index.js @@ -2,7 +2,7 @@ export class AddonStore { constructor() { this.loaders = {}; this.panels = {}; - this.channel = { on() {}, emit() {} }; + this.channel = null; this.preview = null; this.database = null; } From 09682a65ce7e78cd656e85525e527ad44a54c1b1 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Wed, 19 Jul 2017 20:52:20 -0700 Subject: [PATCH 2/3] Add channel error to help debugging --- lib/addons/src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/addons/src/index.js b/lib/addons/src/index.js index f1169d27cd92..90a8a5f99eea 100644 --- a/lib/addons/src/index.js +++ b/lib/addons/src/index.js @@ -1,8 +1,14 @@ +function channelError() { + throw new Error('Tried to access non-existant addons channel, see issues #815 / #1374'); +} + export class AddonStore { constructor() { this.loaders = {}; this.panels = {}; - this.channel = null; + // this.channel should get overwritten by setChannel if package versions are + // correct and AddonStore is a proper singleton. If not, throw an error. + this.channel = { on: channelError, emit: channelError }; this.preview = null; this.database = null; } From 31a034fbc514e9a5a9ddbad33c821d9b132bc8cb Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sat, 22 Jul 2017 02:13:56 -0700 Subject: [PATCH 3/3] Add pointer to null channel FAQ --- lib/addons/src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/addons/src/index.js b/lib/addons/src/index.js index 90a8a5f99eea..e6baf89fdc07 100644 --- a/lib/addons/src/index.js +++ b/lib/addons/src/index.js @@ -1,5 +1,7 @@ function channelError() { - throw new Error('Tried to access non-existant addons channel, see issues #815 / #1374'); + throw new Error( + 'Accessing nonexistent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel' + ); } export class AddonStore {