Tidy up
This commit is contained in:
parent
b8bc25a39a
commit
b82a34d7e1
|
@ -499,15 +499,9 @@
|
||||||
// Check if we already know if this key is used
|
// Check if we already know if this key is used
|
||||||
let used = knownContextKeyMap[key]
|
let used = knownContextKeyMap[key]
|
||||||
|
|
||||||
// If we don't know, check
|
// If we don't know, check and cache
|
||||||
if (used == null) {
|
if (used == null) {
|
||||||
// Check HBS
|
used = bindingString.indexOf(`[${key}]`) !== -1
|
||||||
if (bindingString.indexOf(`[${key}]`) !== -1) {
|
|
||||||
used = true
|
|
||||||
} else {
|
|
||||||
used = false
|
|
||||||
}
|
|
||||||
// Cache result
|
|
||||||
knownContextKeyMap[key] = used
|
knownContextKeyMap[key] = used
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,8 @@
|
||||||
export let actions
|
export let actions
|
||||||
export let key
|
export let key
|
||||||
|
|
||||||
// Clone and create new data context for this component tree
|
|
||||||
const context = getContext("context")
|
const context = getContext("context")
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
|
|
||||||
const providerKey = key || $component.id
|
const providerKey = key || $component.id
|
||||||
|
|
||||||
// Generate a permanent unique ID for this component and use it to register
|
// Generate a permanent unique ID for this component and use it to register
|
||||||
|
|
|
@ -9,12 +9,10 @@ export const createContextStore = () => {
|
||||||
if (!providerId || data === undefined) {
|
if (!providerId || data === undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// console.log(`[${providerId}]`, data)
|
|
||||||
context.update(state => {
|
context.update(state => {
|
||||||
state[providerId] = data
|
state[providerId] = data
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
|
|
||||||
broadcastChange(providerId)
|
broadcastChange(providerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +29,6 @@ export const createContextStore = () => {
|
||||||
|
|
||||||
const observeChanges = callback => {
|
const observeChanges = callback => {
|
||||||
observers.push(callback)
|
observers.push(callback)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
observers = observers.filter(cb => cb !== callback)
|
observers = observers.filter(cb => cb !== callback)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,5 @@ export const enrichDataBinding = async (input, context) => {
|
||||||
* Props are deeply cloned so that no mutation is done to the source object.
|
* Props are deeply cloned so that no mutation is done to the source object.
|
||||||
*/
|
*/
|
||||||
export const enrichDataBindings = (props, context) => {
|
export const enrichDataBindings = (props, context) => {
|
||||||
console.log("enrich")
|
|
||||||
return processObjectSync(Helpers.cloneDeep(props), context, { cache: true })
|
return processObjectSync(Helpers.cloneDeep(props), context, { cache: true })
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
"@apidevtools/swagger-parser": "10.0.3",
|
"@apidevtools/swagger-parser": "10.0.3",
|
||||||
"@budibase/backend-core": "0.0.0",
|
"@budibase/backend-core": "0.0.0",
|
||||||
"@budibase/client": "0.0.0",
|
"@budibase/client": "0.0.0",
|
||||||
"@budibase/pro": "0.0.0",
|
"@budibase/pro": "develop",
|
||||||
"@budibase/shared-core": "0.0.0",
|
"@budibase/shared-core": "0.0.0",
|
||||||
"@budibase/string-templates": "0.0.0",
|
"@budibase/string-templates": "0.0.0",
|
||||||
"@budibase/types": "0.0.0",
|
"@budibase/types": "0.0.0",
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "0.0.0",
|
"@budibase/backend-core": "0.0.0",
|
||||||
"@budibase/pro": "0.0.0",
|
"@budibase/pro": "develop",
|
||||||
"@budibase/string-templates": "0.0.0",
|
"@budibase/string-templates": "0.0.0",
|
||||||
"@budibase/types": "0.0.0",
|
"@budibase/types": "0.0.0",
|
||||||
"@koa/router": "8.0.8",
|
"@koa/router": "8.0.8",
|
||||||
|
|
Loading…
Reference in New Issue