Pass snippets from builder to client when inside the builder preview to ensure new snippets can be evaluated
This commit is contained in:
parent
ccb32af078
commit
d4a657bbfe
|
@ -42,6 +42,7 @@ const loadBudibase = async () => {
|
||||||
hiddenComponentIds: window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"],
|
hiddenComponentIds: window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"],
|
||||||
usedPlugins: window["##BUDIBASE_USED_PLUGINS##"],
|
usedPlugins: window["##BUDIBASE_USED_PLUGINS##"],
|
||||||
location: window["##BUDIBASE_LOCATION##"],
|
location: window["##BUDIBASE_LOCATION##"],
|
||||||
|
snippets: window["##BUDIBASE_SNIPPETS##"],
|
||||||
})
|
})
|
||||||
|
|
||||||
// Set app ID - this window flag is set by both the preview and the real
|
// Set app ID - this window flag is set by both the preview and the real
|
||||||
|
|
|
@ -18,6 +18,7 @@ const createBuilderStore = () => {
|
||||||
usedPlugins: null,
|
usedPlugins: null,
|
||||||
eventResolvers: {},
|
eventResolvers: {},
|
||||||
metadata: null,
|
metadata: null,
|
||||||
|
snippets: null,
|
||||||
|
|
||||||
// Legacy - allow the builder to specify a layout
|
// Legacy - allow the builder to specify a layout
|
||||||
layout: null,
|
layout: null,
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import { derived } from "svelte/store"
|
import { derived } from "svelte/store"
|
||||||
import { appStore } from "../app.js"
|
import { appStore } from "../app.js"
|
||||||
|
import { builderStore } from "../builder.js"
|
||||||
|
|
||||||
export const snippets = derived(appStore, $appStore => {
|
export const snippets = derived(
|
||||||
return $appStore?.application?.snippets || []
|
[appStore, builderStore],
|
||||||
})
|
([$appStore, $builderStore]) => {
|
||||||
|
return $builderStore?.snippets || $appStore?.application?.snippets || []
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
|
@ -72,7 +72,8 @@
|
||||||
navigation,
|
navigation,
|
||||||
hiddenComponentIds,
|
hiddenComponentIds,
|
||||||
usedPlugins,
|
usedPlugins,
|
||||||
location
|
location,
|
||||||
|
snippets
|
||||||
} = parsed
|
} = parsed
|
||||||
|
|
||||||
// Set some flags so the app knows we're in the builder
|
// Set some flags so the app knows we're in the builder
|
||||||
|
@ -89,6 +90,7 @@
|
||||||
window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"] = hiddenComponentIds
|
window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"] = hiddenComponentIds
|
||||||
window["##BUDIBASE_USED_PLUGINS##"] = usedPlugins
|
window["##BUDIBASE_USED_PLUGINS##"] = usedPlugins
|
||||||
window["##BUDIBASE_LOCATION##"] = location
|
window["##BUDIBASE_LOCATION##"] = location
|
||||||
|
window["##BUDIBASE_SNIPPETS##"] = snippets
|
||||||
|
|
||||||
// Initialise app
|
// Initialise app
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue