fix: admin wizard crash and prisma enum generator path resolution (#28244)

* fix: admin wizard crash and prisma enum generator path resolution

1. Fix TypeError in WizardForm when license step is skipped:
   - defaultStep was set to 3 (APPS) but only 2 steps existed when
     hasValidLicense=true, causing steps[2] to be undefined
   - Removed redundant double onNext() call in AdminUser onSuccess
   - Extracted hasLicenseStep variable for clarity

2. Fix prisma enum generator not being directory-safe:
   - Created run-enum-generator.js wrapper resolved by Prisma relative
     to schema directory, so npx prisma commands work from any directory

Co-Authored-By: [email protected] <[email protected]>

* fix: use bin entry for prisma enum generator path resolution

Changed provider from './run-enum-generator.js' (which Prisma doesn't
resolve relative to schema dir) to 'prisma-enum-generator' bin registered
in package.json. This ensures the generator is found via PATH regardless
of CWD.

Co-Authored-By: [email protected] <[email protected]>

* chore: Also add new bin to the lockfile

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Alex van AndelandDevin AI authored and GitHub committed 2026-03-03 07:37:22 -03:00
1 parent 5b88eefed4
commit 1b21ead011
5 files changed
+20 -12

No files matched your search

+8 -11
View File
@@ -30,16 +30,19 @@ export function Setup(props: PageProps) {
props.hasValidLicense ? "EXISTING" : "FREE"
);
const hasLicenseStep = !props.hasValidLicense && !hasPickedAGPLv3;
const defaultStep = useMemo(() => {
if (props.userCount > 0) {
if (!props.hasValidLicense && !hasPickedAGPLv3) {
if (hasLicenseStep) {
return SETUP_VIEW_SETPS.LICENSE;
} else {
return SETUP_VIEW_SETPS.APPS;
// License step is not shown, so apps step is at position 2 instead of 3
return SETUP_VIEW_SETPS.APPS - 1;
}
}
return SETUP_VIEW_SETPS.ADMIN_USER;
}, [props.userCount, props.hasValidLicense, hasPickedAGPLv3]);
}, [props.userCount, hasLicenseStep]);
const steps: WizardStep[] = [
{
@@ -52,13 +55,7 @@ export function Setup(props: PageProps) {
setIsPending(true);
}}
onSuccess={() => {
// If there's already a valid license or user picked AGPLv3, skip to apps step
if (props.hasValidLicense || hasPickedAGPLv3) {
nav.onNext();
nav.onNext(); // Skip license step
} else {
nav.onNext();
}
nav.onNext();
}}
onError={() => {
setIsPending(false);
@@ -71,7 +68,7 @@ export function Setup(props: PageProps) {
];
// Only show license selection step if there's no valid license already and AGPLv3 wasn't picked
if (!props.hasValidLicense && !hasPickedAGPLv3) {
if (hasLicenseStep) {
steps.push({
title: t("choose_a_license"),
description: t("choose_license_description"),