Skip to content

Commit

Permalink
Fix (Public URLs): state initialization (#6126)
Browse files Browse the repository at this point in the history
* Fix public URL state initialization

* Fix lint

* Reactivity just in case
  • Loading branch information
ericpgreen2 committed Nov 21, 2024
1 parent c4c4461 commit 68e069e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script lang="ts">
import type { V1MagicAuthToken } from "@rilldata/web-admin/client";
import { getStateManagers } from "@rilldata/web-common/features/dashboards/state-managers/state-managers";
import { createDashboardStateSync } from "@rilldata/web-common/features/dashboards/stores/syncDashboardState";
import { initLocalUserPreferenceStore } from "@rilldata/web-common/features/dashboards/user-preferences";
import Spinner from "@rilldata/web-common/features/entity-management/Spinner.svelte";
import { EntityStatus } from "@rilldata/web-common/features/entity-management/types";
import { readable } from "svelte/store";
export let exploreName: string;
export let token: V1MagicAuthToken;
$: initLocalUserPreferenceStore(exploreName);
$: dashboardStoreReady = createDashboardStateSync(
getStateManagers(),
readable({
isFetching: false,
data: token.state,
error: null,
}),
);
</script>

{#if $dashboardStoreReady}
<slot />
{:else}
<div class="grid place-items-center mt-40">
<Spinner status={EntityStatus.Running} size="40px" />
</div>
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { onNavigate } from "$app/navigation";
import { page } from "$app/stores";
import { createAdminServiceGetProject } from "@rilldata/web-admin/client";
import DashboardPublicURLStateProvider from "@rilldata/web-admin/features/public-urls/DashboardPublicURLStateProvider.svelte";
import { Dashboard } from "@rilldata/web-common/features/dashboards";
import DashboardThemeProvider from "@rilldata/web-common/features/dashboards/DashboardThemeProvider.svelte";
import DashboardURLStateProvider from "@rilldata/web-common/features/dashboards/proto-state/DashboardURLStateProvider.svelte";
import StateManagersProvider from "@rilldata/web-common/features/dashboards/state-managers/StateManagersProvider.svelte";
import DashboardStateProvider from "@rilldata/web-common/features/dashboards/stores/DashboardStateProvider.svelte";
import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus";
import { createRuntimeServiceGetExplore } from "@rilldata/web-common/runtime-client";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
Expand Down Expand Up @@ -52,7 +52,10 @@
metricsViewName={explore.metricsView.meta.name.name}
exploreName={resourceName}
>
<DashboardStateProvider exploreName={resourceName}>
<DashboardPublicURLStateProvider
token={data.token}
exploreName={resourceName}
>
<DashboardURLStateProvider
metricsViewName={explore.metricsView.meta.name.name}
>
Expand All @@ -63,7 +66,7 @@
/>
</DashboardThemeProvider>
</DashboardURLStateProvider>
</DashboardStateProvider>
</DashboardPublicURLStateProvider>
</StateManagersProvider>
{/if}
{/key}

1 comment on commit 68e069e

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.