Skip to content

Commit 99e1f81

Browse files
committed
feat(vercel): add pullNewEnvVars option and modal dismiss control
Add pullNewEnvVars to Vercel integration types, schema, defaults, and parsing so integrations can opt into discovering new environment variables from Vercel during builds. - Add pullNewEnv boolean to VercelProjectIntegrationData and to the Vercel integration Zod schema (nullable/optional). - Default pullNewEnvVars to true in createDefaultVercelIntegrationData and update defaults for atomicBuilds and pullEnvVarsBeforeBuild to include non-dev environments. - Add helper isPullNewEnvVarsEnabled to coerce undefined/null to true. - Parse pullNewEnvVars from route form input (string -> boolean|null). Also improve GitHub connect modal handling: - Add preventDismiss prop to the connect GitHub modal component. - Prevent closing the modal via Escape key or clicking outside when preventDismiss is true by blocking onInteractOutside/onEscapeKeyDown and refusing to change open state when attempting to close. These changes enable automatic discovery of new Vercel env vars by default and provide a way to force modal persistence during critical flows.
1 parent 3b92fbd commit 99e1f81

5 files changed

+454
-200
lines changed

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.github.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,15 @@ export function ConnectGitHubRepoModal({
330330
projectSlug,
331331
environmentSlug,
332332
redirectUrl,
333+
preventDismiss,
333334
}: {
334335
gitHubAppInstallations: GitHubAppInstallation[];
335336
organizationSlug: string;
336337
projectSlug: string;
337338
environmentSlug: string;
338339
redirectUrl?: string;
340+
/** When true, prevents closing the modal via Escape key or clicking outside */
341+
preventDismiss?: boolean;
339342
}) {
340343
const [isModalOpen, setIsModalOpen] = useState(false);
341344
const lastSubmission = useActionData() as any;
@@ -385,13 +388,34 @@ export function ConnectGitHubRepoModal({
385388
const actionUrl = gitHubResourcePath(organizationSlug, projectSlug, environmentSlug);
386389

387390
return (
388-
<Dialog open={isModalOpen} onOpenChange={setIsModalOpen}>
391+
<Dialog
392+
open={isModalOpen}
393+
onOpenChange={(open) => {
394+
// When preventDismiss is true, only allow opening, not closing
395+
if (preventDismiss && !open) {
396+
return;
397+
}
398+
setIsModalOpen(open);
399+
}}
400+
>
389401
<DialogTrigger asChild>
390402
<Button type="button" variant={"secondary/medium"} LeadingIcon={OctoKitty}>
391403
Connect GitHub repo
392404
</Button>
393405
</DialogTrigger>
394-
<DialogContent>
406+
<DialogContent
407+
showCloseButton={!preventDismiss}
408+
onInteractOutside={(e) => {
409+
if (preventDismiss) {
410+
e.preventDefault();
411+
}
412+
}}
413+
onEscapeKeyDown={(e) => {
414+
if (preventDismiss) {
415+
e.preventDefault();
416+
}
417+
}}
418+
>
395419
<DialogHeader>Connect GitHub repository</DialogHeader>
396420
<div className="mt-2 flex flex-col gap-4">
397421
<Form method="post" action={actionUrl} {...form.props} className="w-full">

0 commit comments

Comments
 (0)