Skip to content

Commit b0553df

Browse files
authored
Merge pull request #2961 from appwrite/chore-add-org-guard
fix(console): guard organization access in realtimePricing to prevent runtime crash
2 parents c601562 + d4fb158 commit b0553df

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/lib/components/billing/alerts/realtimePricing.svelte

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@
1616
}
1717
}
1818
19-
$: href = $currentPlan?.usagePerProject
20-
? `${base}/organization-${$organization.$id}/billing`
21-
: `${base}/organization-${$organization.$id}/usage`;
19+
// Guard org id: this reactive runs even when the {#if} below is false, so optional
20+
// chaining on $currentPlan alone is not enough — $organization can be undefined.
21+
$: orgId = $organization?.$id;
22+
$: href = orgId
23+
? $currentPlan?.usagePerProject
24+
? `${base}/organization-${orgId}/billing`
25+
: `${base}/organization-${orgId}/usage`
26+
: '';
2227
</script>
2328

2429
{#if $organization?.$id && !dismissed}

0 commit comments

Comments
 (0)