Skip to content

Commit 349feb0

Browse files
committed
feat(webapp): auto-select and optimize project selector
Automatically set the Vercel project when entering project-selection if there is at least one available project and none selected. This prevents an empty selection state and reduces manual clicks for the common case of a single or first project. Disable the Select when there is exactly one available project to make the intent explicit and avoid unnecessary interaction. Add a filter prop to the Select only when there are more than five projects to keep the dropdown performant and avoid enabling filtering for small lists. Adjust the effect deps to trigger selection only on relevant state and project list changes.
1 parent 7b296ce commit 349feb0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apps/webapp/app/components/integrations/VercelOnboardingModal.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,12 @@ export function VercelOnboardingModal({
565565
}
566566
}, [state, customEnvironments, vercelStagingEnvironment]);
567567

568+
useEffect(() => {
569+
if (state === "project-selection" && availableProjects.length > 0 && !selectedVercelProject) {
570+
setSelectedVercelProject(availableProjects[0]);
571+
}
572+
}, [state, availableProjects, selectedVercelProject]);
573+
568574
if (!isOpen || onboardingData?.authInvalid) {
569575
return null;
570576
}
@@ -625,6 +631,7 @@ export function VercelOnboardingModal({
625631
</Callout>
626632
) : (
627633
<Select
634+
disabled={availableProjects.length === 1}
628635
value={selectedVercelProject?.id || ""}
629636
setValue={(value) => {
630637
if (!Array.isArray(value)) {
@@ -634,6 +641,7 @@ export function VercelOnboardingModal({
634641
}
635642
}}
636643
items={availableProjects}
644+
filter={availableProjects.length > 5 ? { keys: ["name"] } : undefined}
637645
variant="tertiary/medium"
638646
placeholder="Select a Vercel project"
639647
dropdownIcon

0 commit comments

Comments
 (0)