From c6dbd52c889c7b7bde04c762da38bc8966289587 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 9 Jun 2022 15:55:59 +0100 Subject: [PATCH] Show devtools even in client app error states, to fix being locked out when changing to a public preview --- .../client/src/components/ClientApp.svelte | 125 +++++++++--------- packages/client/src/stores/devTools.js | 5 +- 2 files changed, 66 insertions(+), 64 deletions(-) diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte index e9a66229dd..db9f30fdab 100644 --- a/packages/client/src/components/ClientApp.svelte +++ b/packages/client/src/components/ClientApp.svelte @@ -120,46 +120,55 @@ > - {#if permissionError} -
- {#if showDevTools} - - {/if} -
- - {@html ErrorSVG} - You don't have permission to use this app - Ask your administrator to grant you access - -
-
- {:else if $screenStore.activeLayout} - - - - - {#key $builderStore.selectedComponentId} - {#if $builderStore.inBuilder} - + + + + + {#key $builderStore.selectedComponentId} + {#if $builderStore.inBuilder} + + {/if} + {/key} + + +
+ +
+ {#if showDevTools} + {/if} - {/key} - -
- -
- {#if showDevTools} - - {/if} - -
+
+ {#if permissionError} +
+ + {@html ErrorSVG} + + You don't have permission to use this app + + + Ask your administrator to grant you access + + +
+ {:else if !$screenStore.activeLayout} +
+ + {@html ErrorSVG} + + Something went wrong rendering your app + + + Get in touch with support if this issue persists + + +
+ {:else} {#key $screenStore.activeLayout._id} + {/if} - {#if showDevTools} - - {/if} -
+ {#if showDevTools} + + {/if}
- - - {#if $appStore.isDevApp} - - {/if} - {#if $builderStore.inBuilder || $devToolsStore.allowSelection} - - {/if} - {#if $builderStore.inBuilder} - - {/if}
- - - {/if} + + + {#if $appStore.isDevApp} + + {/if} + {#if $builderStore.inBuilder || $devToolsStore.allowSelection} + + {/if} + {#if $builderStore.inBuilder} + + {/if} +
+ +
@@ -253,10 +262,6 @@ overflow: hidden; } - .error-wrapper { - width: 100%; - height: 100%; - } .error { width: 100%; height: 100%; diff --git a/packages/client/src/stores/devTools.js b/packages/client/src/stores/devTools.js index 1558f54862..4abfe33b7b 100644 --- a/packages/client/src/stores/devTools.js +++ b/packages/client/src/stores/devTools.js @@ -1,6 +1,4 @@ -import { get } from "svelte/store" import { createLocalStorageStore } from "@budibase/frontend-core" -import { appStore } from "./app" import { initialise } from "./initialise" import { authStore } from "./auth" import { API } from "../api" @@ -13,8 +11,7 @@ const initialState = { } const createDevToolStore = () => { - const localStorageKey = `${get(appStore).appId}.devTools` - const store = createLocalStorageStore(localStorageKey, initialState) + const store = createLocalStorageStore("bb-devtools", initialState) const setEnabled = enabled => { store.update(state => ({