Skip to content
Merged
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
6 changes: 3 additions & 3 deletions src/routes/(console)/organization-[organization]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@
</Alert.Inline>
{/if}

{#if isCloud && data.currentPlan?.projects !== 0 && projectsToArchive.length === 0 && !freePlanAlertDismissed}
{#if isCloud && !data.program && data.currentPlan?.projects !== 0 && projectsToArchive.length === 0 && !freePlanAlertDismissed}
<Alert.Inline dismissible on:dismiss={dismissFreePlanAlert}>
<Typography.Text
>Your Free plan includes up to 2 projects and limited resources. Upgrade to unlock
more capacity and features.</Typography.Text>
>Your Free plan includes up to {data.currentPlan?.projects} projects and limited resources.
Upgrade to unlock more capacity and features.</Typography.Text>
Comment on lines +222 to +226
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Minor: undefined !== 0 is true — the guard doesn't protect against a missing currentPlan.

If data.currentPlan were ever null/undefined, the check data.currentPlan?.projects !== 0 evaluates to undefined !== 0true, so the alert would render with the text "up to undefined projects". This is likely safe in practice (cloud layouts should always load currentPlan), but a small tweak makes it more robust:

Suggested defensive tweak
-    {`#if` isCloud && !data.program && data.currentPlan?.projects !== 0 && projectsToArchive.length === 0 && !freePlanAlertDismissed}
+    {`#if` isCloud && !data.program && data.currentPlan?.projects && projectsToArchive.length === 0 && !freePlanAlertDismissed}

Using truthiness (data.currentPlan?.projects is falsy for both 0 and undefined/null) collapses the two failure modes into one check and avoids rendering "undefined" in the message.

🤖 Prompt for AI Agents
In `@src/routes/`(console)/organization-[organization]/+page.svelte around lines
222 - 226, The conditional renders an alert when data.currentPlan may be
undefined because `data.currentPlan?.projects !== 0` is true for undefined;
change the guard to ensure projects is present and non-zero (e.g., check
`data.currentPlan?.projects` truthiness or explicitly
`data.currentPlan?.projects > 0`) so the Alert.Inline/Tyography.Text never shows
"up to undefined projects"; update the condition in the same expression that
uses isCloud, data.currentPlan?.projects, projectsToArchive.length,
freePlanAlertDismissed and keep dismissFreePlanAlert behavior unchanged.

<svelte:fragment slot="actions">
<Button
compact
Expand Down