Skip to content

Commit 70f9cef

Browse files
committed
export storeEnv
1 parent 360997a commit 70f9cef

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// note: addons, panels and events get unique names using a prefix
22
import register from './register';
33
import * as addonManager from './store/decorator';
4+
import _initStore from './store/store';
45

56
export const ADDON_ID = 'sm/storybook-adk';
67
export const ADDON_TITLE = 'PODDA';
@@ -12,3 +13,7 @@ export const CSS_CLASS = 'adk-ui';
1213
export { addonComposer } from './store/addonComposer';
1314
export { register };
1415
export { addonManager };
16+
17+
export function initStore(...arg) {
18+
return _initStore(...arg);
19+
}

src/register.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ADDON_ID, PANEL_ID, ADDON_TITLE, CSS_CLASS } from './';
1515
// CSS_CLASS,
1616
//};
1717

18-
export default function (addonSettings) {
18+
export default function (addonSettings, onRegister) {
1919
const settings = addonSettings.config;
2020
// const { defaultData, addonApi, config } = addonSettings;
2121
addons.register(settings.ADDON_ID, (api) => {
@@ -46,5 +46,17 @@ export default function (addonSettings) {
4646
/>),
4747
});
4848
}
49+
// else {
50+
// addons.addPanel('no', {
51+
// title: 'no',
52+
// render: () => {
53+
// if (onRegister) onRegister(addonStoreEnv);
54+
// return null
55+
// }
56+
// });
57+
// }
58+
59+
if (onRegister) onRegister(addonStoreEnv);
60+
4961
});
5062
}

src/store/store.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export default function initStore(storeSettings, storybookApi) {
205205
const setChannelSlave = (initData) => {
206206
peerId = initData.id;
207207
channelRole = CHANNEL_SLAVE;
208+
queryInitData = queryInitData || queryFetch(queryParams, storybookApi);
208209
channel.emit(config.EVENT_ID_INIT, {
209210
info: 'so I\'m a slave',
210211
role: channelRole,
@@ -280,6 +281,8 @@ export default function initStore(storeSettings, storybookApi) {
280281
const stopQuerySubscription = addonStore.watch(
281282
'queryData', watchQuery);
282283

284+
loggerC.info('setupChannel:');
285+
283286
try {
284287
queryInitData = queryFetch(queryParams, storybookApi) || queryInitData;
285288
if (queryInitData) {

0 commit comments

Comments
 (0)