Skip to content

Commit 74ab88a

Browse files
committed
fix(webapp): read the promoted-prompt flag only when the agent has access
The env layout loader queried the feature flag unconditionally; without agent access the panel never mounts, so the read was wasted — and main's new environment-ownership test (which stubs a minimal prisma) caught it.
1 parent 7bf5a10 commit 74ab88a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam/route.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
9090
orgFeatureFlags: (project.organization.featureFlags as Record<string, unknown>) ?? {},
9191
});
9292

93-
const promotedDashboardAgentPrompt = await getPromotedDashboardAgentPrompt({
94-
orgFeatureFlags: (project.organization.featureFlags as Record<string, unknown>) ?? {},
95-
});
93+
// Only read the promoted-prompt flag when the agent renders at all — without
94+
// access the panel never mounts, so the flag read would be a wasted query.
95+
const promotedDashboardAgentPrompt = hasDashboardAgentAccess
96+
? await getPromotedDashboardAgentPrompt({
97+
orgFeatureFlags: (project.organization.featureFlags as Record<string, unknown>) ?? {},
98+
})
99+
: null;
96100

97101
return {
98102
...project,

0 commit comments

Comments
 (0)