Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<script lang="ts">
import { Container } from '$lib/layout';
import { base } from '$app/paths';
import { page } from '$app/state';
import { Container, Usage } from '$lib/layout';

export let data;
$: total = data.deploymentsTotal;
$: count = data.deployments;
Comment on lines +7 to +8
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Data loader returns empty object — chart never renders

Both data.deploymentsTotal and data.deployments will always be undefined because functions/usage/[[period]]/+page.ts returns {} with no API call. The Usage component renders its chart only when count is truthy ({#if count}), so the chart will be blank for every visitor. The same issue applies to the sites usage page (sites/usage/[[period]]/+page.ts).

Compare with the working per-function usage loader at functions/function-[function]/usage/[[period]]/+page.ts, which calls sdk.forProject(...).functions.getUsage(...) and spreads the result into the returned data object. The aggregate usage pages need a similar API call wired up in their +page.ts before this template change has any visible effect.

</script>

<Container></Container>
<Container>
<Usage
path={`${base}/project-${page.params.region}-${page.params.project}/functions/usage`}
countMetadata={{
legend: 'Deployments',
title: 'Total deployments'
}}
{total}
{count} />
</Container>
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<script lang="ts">
import { Container } from '$lib/layout';
import { base } from '$app/paths';
import { page } from '$app/state';
import { Container, Usage } from '$lib/layout';

export let data;
$: total = data.deploymentsTotal;
$: count = data.deployments;
</script>

<Container></Container>
<Container>
<Usage
path={`${base}/project-${page.params.region}-${page.params.project}/sites/usage`}
countMetadata={{
legend: 'Deployments',
title: 'Total deployments'
}}
{total}
{count} />
</Container>