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