From 1a012515f9aa7a699c7e987ae1536f096329529b Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Mon, 14 Sep 2020 12:32:10 +0100 Subject: [PATCH] fix: re-exposing store in component api, as form depends on it --- packages/client/src/state/bbComponentApi.js | 1 + packages/client/src/state/store.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/packages/client/src/state/bbComponentApi.js b/packages/client/src/state/bbComponentApi.js index d055d4a05b..99503bb2b9 100644 --- a/packages/client/src/state/bbComponentApi.js +++ b/packages/client/src/state/bbComponentApi.js @@ -47,6 +47,7 @@ export const bbFactory = ({ setBinding: setBindableComponentProp(treeNode), api, parent, + store: store.getStore(treeNode.contextStoreKey), // these parameters are populated by screenRouter routeParams: () => store.getState()["##routeParams"], } diff --git a/packages/client/src/state/store.js b/packages/client/src/state/store.js index 5b1ac54375..7895700cd0 100644 --- a/packages/client/src/state/store.js +++ b/packages/client/src/state/store.js @@ -94,6 +94,9 @@ const set = (value, dataProviderId, childIndex) => const getState = contextStoreKey => contextStoreKey ? contextStores[contextStoreKey].state : rootState +const getStore = contextStoreKey => + contextStoreKey ? contextStores[contextStoreKey] : rootStore + export default { subscribe, update, @@ -101,4 +104,5 @@ export default { getState, create, contextStoreKey, + getStore, }