fix: onboarding issues by ogzhanolguncu · Pull Request #5301 · unkeyed/unkey
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/components/deployment-domains-card.tsx (1)
20-24: ⚠️ Potential issue | 🟡 MinorCoerce the optional
glowprop before passing it toGlowIcon.
GlowIcontreatsundefinedastrue, but this component still treats an omittedglowprop as false foriconClassName. That changes the default rendering from a plain icon to a pulsing one whenever callers leaveglowunset.💡 Minimal fix
<GlowIcon icon={<Cube iconSize="md-medium" className="size-[18px]" />} - glow={glow} + glow={Boolean(glow)} className="w-full h-full" />Also applies to: 63-69
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/apps/dashboard/app/`(app)/[workspaceSlug]/projects/[projectId]/components/deployment-domains-card.tsx around lines 20 - 24, The component DeploymentDomainsCard treats an omitted glow prop differently from GlowIcon (GlowIcon treats undefined as true), so coerce the optional glow into an explicit boolean before use (e.g., const showGlow = glow !== false) and use that showGlow when calling GlowIcon and when computing iconClassName so both places have the same default behavior; update all occurrences in the component (including the other block referenced around lines 63-69) to reference showGlow instead of the raw glow prop.
🧹 Nitpick comments (2)
web/apps/dashboard/lib/trpc/routers/deploy/project/create.ts (1)
160-173: Guard the regional settings insert whenregionsis empty.Drizzle ORM throws with
'values() must be called with at least one value'when.values([])is passed. This code will fail project creation if the regions table is unseeded, since[prodEnvId, previewEnvId].flatMap(...)produces an empty array when regions is empty. Add a guard to avoid that failure mode.Suggested minimal patch
const regions = await tx.query.regions.findMany({ columns: { id: true } }); - await tx.insert(schema.appRegionalSettings).values( - [prodEnvId, previewEnvId].flatMap((environmentId) => - regions.map((r) => ({ - workspaceId: ctx.workspace.id, - appId, - environmentId, - regionId: r.id, - replicas: 1, - createdAt: Date.now(), - updatedAt: Date.now(), - })), - ), - ); + const regionalSettings = [prodEnvId, previewEnvId].flatMap((environmentId) => + regions.map((r) => ({ + workspaceId: ctx.workspace.id, + appId, + environmentId, + regionId: r.id, + replicas: 1, + createdAt: Date.now(), + updatedAt: Date.now(), + })), + ); + + if (regionalSettings.length > 0) { + await tx.insert(schema.appRegionalSettings).values(regionalSettings); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/apps/dashboard/lib/trpc/routers/deploy/project/create.ts` around lines 160 - 173, The insert into appRegionalSettings calls .values(...) with a flattened array from regions and will throw if regions is empty; to fix, build the payload array (e.g., map over regions for each of prodEnvId and previewEnvId) and only call tx.insert(schema.appRegionalSettings).values(payload) when payload.length > 0 (guarding against regions.length === 0), referencing the existing variables regions, prodEnvId, previewEnvId, ctx.workspace.id and appId so no insert is attempted with an empty array.web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/components/glow-icon.tsx (1)
24-30: Minor: Redundant ternary branches.The
glowVisiblelogic has identical outcomes forglow === truein bothtransitionbranches ("animate-pulse opacity-20"). This could be simplified, but the current structure may be intentional for future differentiation.♻️ Optional simplification
const glowVisible = transition - ? glow - ? "animate-pulse opacity-20" - : "opacity-0 transition-opacity duration-300" - : glow - ? "animate-pulse opacity-20" - : "hidden"; + ? glow + ? "animate-pulse opacity-20" + : "opacity-0 transition-opacity duration-300" + : glow + ? "animate-pulse opacity-20" + : "hidden";If transition behavior should differ in the future, the current structure is fine. Otherwise:
- const glowVisible = transition - ? glow - ? "animate-pulse opacity-20" - : "opacity-0 transition-opacity duration-300" - : glow - ? "animate-pulse opacity-20" - : "hidden"; + const glowVisible = glow + ? "animate-pulse opacity-20" + : transition + ? "opacity-0 transition-opacity duration-300" + : "hidden";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@web/apps/dashboard/app/`(app)/[workspaceSlug]/projects/[projectId]/components/glow-icon.tsx around lines 24 - 30, The conditional for glowVisible currently repeats the same branch for glow === true; simplify by checking glow first: if glow is true return "animate-pulse opacity-20", otherwise return transition ? "opacity-0 transition-opacity duration-300" : "hidden". Update the glowVisible assignment (the variable named glowVisible that uses transition and glow) to use this simplified logic so behavior is unchanged but redundant ternary branches are removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@web/apps/dashboard/app/`(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/pending-redeploy-banner.tsx:
- Around line 35-45: The onSuccess handler for the redeploy mutation (redeploy
in trpc.deploy.deployment.redeploy.useMutation) currently calls
queryClient.invalidateQueries(...).then(() => router.push(...)) but does not
return that Promise, so the mutation becomes non-pending before navigation
starts; fix by returning the Promise from onSuccess (make the onSuccess async
and await/return queryClient.invalidateQueries(...) before calling router.push
or simply return queryClient.invalidateQueries(...).then(...)) and ensure you
reference currentDeploymentRef.current and router.push to perform navigation
after the awaited invalidation.
In `@web/apps/dashboard/lib/collections/deploy/environment-settings.ts`:
- Around line 53-58: _wrap each subscriber invocation in _notifySaveSubscribers
so that callbacks from _saveSubscribers are executed inside a try/catch that
prevents exceptions from bubbling; log or ignore the error but do not rethrow,
ensuring the caller (dispatchSettingsMutations) can always reach its finally
block and decrement _pendingSaves; apply the same defensive try/catch pattern to
the other subscriber loop mentioned (the saved-listener loop around lines
303-314) so listener exceptions cannot convert a successful save into a rejected
update or leave _pendingSaves stuck.
---
Outside diff comments:
In
`@web/apps/dashboard/app/`(app)/[workspaceSlug]/projects/[projectId]/components/deployment-domains-card.tsx:
- Around line 20-24: The component DeploymentDomainsCard treats an omitted glow
prop differently from GlowIcon (GlowIcon treats undefined as true), so coerce
the optional glow into an explicit boolean before use (e.g., const showGlow =
glow !== false) and use that showGlow when calling GlowIcon and when computing
iconClassName so both places have the same default behavior; update all
occurrences in the component (including the other block referenced around lines
63-69) to reference showGlow instead of the raw glow prop.
---
Nitpick comments:
In
`@web/apps/dashboard/app/`(app)/[workspaceSlug]/projects/[projectId]/components/glow-icon.tsx:
- Around line 24-30: The conditional for glowVisible currently repeats the same
branch for glow === true; simplify by checking glow first: if glow is true
return "animate-pulse opacity-20", otherwise return transition ? "opacity-0
transition-opacity duration-300" : "hidden". Update the glowVisible assignment
(the variable named glowVisible that uses transition and glow) to use this
simplified logic so behavior is unchanged but redundant ternary branches are
removed.
In `@web/apps/dashboard/lib/trpc/routers/deploy/project/create.ts`:
- Around line 160-173: The insert into appRegionalSettings calls .values(...)
with a flattened array from regions and will throw if regions is empty; to fix,
build the payload array (e.g., map over regions for each of prodEnvId and
previewEnvId) and only call
tx.insert(schema.appRegionalSettings).values(payload) when payload.length > 0
(guarding against regions.length === 0), referencing the existing variables
regions, prodEnvId, previewEnvId, ctx.workspace.id and appId so no insert is
attempted with an empty array.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 6585f684-9a59-4e41-b519-4b011022b1e3
📒 Files selected for processing (16)
web/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/[deploymentId]/(deployment-progress)/deployment-step.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/deployments/components/table/components/actions/redeploy-dialog.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/environment-provider.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/page.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/(overview)/settings/pending-redeploy-banner.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/components/deployment-domains-card.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/[projectId]/components/glow-icon.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/configure-deployment.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/configure-deployment/content.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/configure-deployment/environment-inner.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/configure-deployment/environment-provider.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/configure-deployment/fallback.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/configure-deployment/index.tsxweb/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/onboarding-environment-provider.tsxweb/apps/dashboard/lib/collections/deploy/environment-settings.tsweb/apps/dashboard/lib/trpc/routers/deploy/project/create.ts
💤 Files with no reviewable changes (2)
- web/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/configure-deployment.tsx
- web/apps/dashboard/app/(app)/[workspaceSlug]/projects/new/steps/onboarding-environment-provider.tsx