From 9109681bbe0f4a09dd47b3361760c70ec4a88dcb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 9 Feb 2024 13:04:30 +0000 Subject: [PATCH 1/4] Fix creators being unable to click on apps they have non-creator access to --- .../builder/src/components/start/AppRow.svelte | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/components/start/AppRow.svelte b/packages/builder/src/components/start/AppRow.svelte index 212ab4c6f8..c05ae4c624 100644 --- a/packages/builder/src/components/start/AppRow.svelte +++ b/packages/builder/src/components/start/AppRow.svelte @@ -11,6 +11,7 @@ $: editing = app.sessions?.length $: isBuilder = sdk.users.isBuilder($auth.user, app?.devId) + $: unclickable = !isBuilder && !app.deployed const handleDefaultClick = () => { if (!isBuilder) { @@ -31,11 +32,17 @@ } const goToApp = () => { - window.open(`/app/${app.name}`, "_blank") + if (app.deployed && app.url) { + window.open(`/app${app.url}`, "_blank") + } } -
+
@@ -74,7 +81,7 @@ Edit
- {:else} + {:else if app.deployed}
@@ -94,7 +101,7 @@ transition: border 130ms ease-out; border: 1px solid transparent; } - .app-row:hover { + .app-row:not(.unclickable):hover { cursor: pointer; border-color: var(--spectrum-global-color-gray-300); } From f52379853fef3bd31bfcc0b5e501673242356748 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 9 Feb 2024 16:44:11 +0000 Subject: [PATCH 2/4] Observe context changes in client components immediately after the first enrichment --- .../client/src/components/Component.svelte | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte index 6694022b98..6d6af91dcc 100644 --- a/packages/client/src/components/Component.svelte +++ b/packages/client/src/components/Component.svelte @@ -113,6 +113,9 @@ // List of context keys which we use inside bindings let knownContextKeyMap = {} + // Cleanup function to stop observing context changes when unmounting + let unobserve + // Set up initial state for each new component instance $: initialise(instance) @@ -311,6 +314,11 @@ // Force an initial enrichment of the new settings enrichComponentSettings(get(context), settingsDefinitionMap) + + // Start observing changes in context now that we are initialised + if (!unobserve) { + unobserve = context.actions.observeChanges(handleContextChange) + } } // Extracts a map of all context keys which are required by action settings @@ -567,8 +575,8 @@ } } - // Register an unregister component instance onMount(() => { + // Register this component instance for external access if ($appStore.isDevApp) { if (!componentStore.actions.isComponentRegistered(id)) { componentStore.actions.registerInstance(id, { @@ -581,16 +589,17 @@ state: store, }) } - return () => { - if (componentStore.actions.isComponentRegistered(id)) { - componentStore.actions.unregisterInstance(id) - } + } + return () => { + // Unregister component + if (componentStore.actions.isComponentRegistered(id)) { + componentStore.actions.unregisterInstance(id) } + + // Stop observing context changes + unobserve?.() } }) - - // Observe changes to context - onMount(() => context.actions.observeChanges(handleContextChange)) {#if constructor && initialSettings && (visible || inSelectedPath) && !builderHidden} From 07a8807dc0f741e597a7272e4fd294b0227f8ea2 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 12 Feb 2024 11:47:26 +0000 Subject: [PATCH 3/4] Bump account portal to satisfy CI --- packages/account-portal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account-portal b/packages/account-portal index cc12291732..aaf64dd002 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit cc12291732ee902dc832bc7d93cf2086ffdf0cff +Subproject commit aaf64dd002a7d2b9ff37f989e03d444c9b9f2b36 From b7e34d1849018eeda59b1806950acf513ff734cf Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 13 Feb 2024 15:50:49 +0000 Subject: [PATCH 4/4] Bump account portal again --- packages/account-portal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account-portal b/packages/account-portal index aaf64dd002..ba40a46748 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit aaf64dd002a7d2b9ff37f989e03d444c9b9f2b36 +Subproject commit ba40a467484963f8041144345469f4b395e31acc