Hide state bindings if feature is not available

This commit is contained in:
Andrew Kingston 2021-09-02 11:39:41 +01:00
parent 04a26f3344
commit bf8975ec6d
1 changed files with 10 additions and 6 deletions

View File

@ -266,12 +266,16 @@ const getDeviceBindings = () => {
* Gets all state bindings that are globally available. * Gets all state bindings that are globally available.
*/ */
const getStateBindings = () => { const getStateBindings = () => {
let bindings = []
if (get(store).clientFeatures?.state) {
const safeState = makePropSafe("state") const safeState = makePropSafe("state")
return getAllStateVariables().map(key => ({ bindings = getAllStateVariables().map(key => ({
type: "context", type: "context",
runtimeBinding: `${safeState}.${makePropSafe(key)}`, runtimeBinding: `${safeState}.${makePropSafe(key)}`,
readableBinding: `State.${key}`, readableBinding: `State.${key}`,
})) }))
}
return bindings
} }
/** /**