diff --git a/packages/client/manifest.json b/packages/client/manifest.json
index 639efe5b79..b6bb6edc58 100644
--- a/packages/client/manifest.json
+++ b/packages/client/manifest.json
@@ -3373,7 +3373,7 @@
"label": "Rows",
"key": "rows"
},
- {
+ {
"label": "Extra Info",
"key": "info"
},
diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte
index d55b00ef9c..5d9225420f 100644
--- a/packages/client/src/components/ClientApp.svelte
+++ b/packages/client/src/components/ClientApp.svelte
@@ -142,7 +142,7 @@
- {#if $devToolsStore.visible && !$builderStore.inBuilder}
+ {#if $appStore.isDevApp && !$builderStore.inBuilder}
{/if}
diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte
index f9e3027ecf..8cba634f2c 100644
--- a/packages/client/src/components/Component.svelte
+++ b/packages/client/src/components/Component.svelte
@@ -17,7 +17,7 @@
propsAreSame,
getSettingsDefinition,
} from "utils/componentProps"
- import { builderStore, devToolsStore, componentStore } from "stores"
+ import { builderStore, devToolsStore, componentStore, appStore } from "stores"
import { Helpers } from "@budibase/bbui"
import Manifest from "manifest.json"
import { getActiveConditions, reduceConditionActions } from "utils/conditions"
@@ -349,15 +349,25 @@
}
onMount(() => {
- componentStore.actions.registerInstance(id, {
- getSettings: () => cachedSettings,
- getRawSettings: () => ({ ...staticSettings, ...dynamicSettings }),
- getDataContext: () => get(context),
- })
+ if (
+ $appStore.isDevApp &&
+ !componentStore.actions.isComponentRegistered(id)
+ ) {
+ componentStore.actions.registerInstance(id, {
+ getSettings: () => cachedSettings,
+ getRawSettings: () => ({ ...staticSettings, ...dynamicSettings }),
+ getDataContext: () => get(context),
+ })
+ }
})
onDestroy(() => {
- componentStore.actions.unregisterInstance(id)
+ if (
+ $appStore.isDevApp &&
+ componentStore.actions.isComponentRegistered(id)
+ ) {
+ componentStore.actions.unregisterInstance(id)
+ }
})
diff --git a/packages/client/src/components/devtools/DevTools.svelte b/packages/client/src/components/devtools/DevTools.svelte
index 731695e29c..cf21f16503 100644
--- a/packages/client/src/components/devtools/DevTools.svelte
+++ b/packages/client/src/components/devtools/DevTools.svelte
@@ -3,34 +3,40 @@
import { Layout, Heading, Tabs, Tab, Icon } from "@budibase/bbui"
import DevToolsStatsTab from "./DevToolsStatsTab.svelte"
import DevToolsComponentTab from "./DevToolsComponentTab.svelte"
- import { devToolsStore } from "../../stores"
+ import { devToolsStore } from "stores"
const context = getContext("context")
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/packages/client/src/components/devtools/DevToolsStatsTab.svelte b/packages/client/src/components/devtools/DevToolsStatsTab.svelte
index dffca9d145..ab029db815 100644
--- a/packages/client/src/components/devtools/DevToolsStatsTab.svelte
+++ b/packages/client/src/components/devtools/DevToolsStatsTab.svelte
@@ -1,6 +1,6 @@
@@ -21,6 +21,7 @@
label="Active screen"
value={$screenStore.activeScreen?.routing.route}
/>
+
diff --git a/packages/client/src/stores/components.js b/packages/client/src/stores/components.js
index af7aa5f0cb..4f972b23c7 100644
--- a/packages/client/src/stores/components.js
+++ b/packages/client/src/stores/components.js
@@ -9,8 +9,8 @@ const createComponentStore = () => {
const store = writable({})
const derivedStore = derived(
- [builderStore, devToolsStore, screenStore],
- ([$builderState, $devToolsState, $screenState]) => {
+ [store, builderStore, devToolsStore, screenStore],
+ ([$store, $builderState, $devToolsState, $screenState]) => {
// Avoid any of this logic if we aren't in the builder preview
if (!$builderState.inBuilder && !$devToolsState.visible) {
return {}
@@ -34,10 +34,12 @@ const createComponentStore = () => {
findComponentPathById(asset?.props, selectedComponentId) || []
return {
- selectedComponentInstance: get(store)[selectedComponentId],
+ selectedComponentInstance: $store[selectedComponentId],
selectedComponent: component,
selectedComponentDefinition: definition,
selectedComponentPath: path?.map(component => component._id),
+ mountedComponents: Object.keys($store).length,
+ currentAsset: asset,
}
}
)
@@ -56,9 +58,23 @@ const createComponentStore = () => {
})
}
+ const isComponentRegistered = id => {
+ return get(store)[id] != null
+ }
+
+ const getComponentById = id => {
+ const asset = get(derivedStore).currentAsset
+ return findComponentById(asset?.props, id)
+ }
+
return {
...derivedStore,
- actions: { registerInstance, unregisterInstance },
+ actions: {
+ registerInstance,
+ unregisterInstance,
+ isComponentRegistered,
+ getComponentById,
+ },
}
}