Skip to content

Commit fbb2ec9

Browse files
fix: defaultChainId should be validated in refine (#5638)
1 parent 5070e76 commit fbb2ec9

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/auth-options-form.client.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ export function AuthOptionsForm({ ecosystem }: { ecosystem: Ecosystem }) {
8686
.optional(),
8787
useSmartAccount: z.boolean(),
8888
sponsorGas: z.boolean(),
89-
defaultChainId: z.coerce.number({
90-
invalid_type_error: "Please enter a valid chain ID",
91-
}),
89+
defaultChainId: z.coerce
90+
.number({
91+
invalid_type_error: "Please enter a valid chain ID",
92+
})
93+
.optional(),
9294
accountFactoryType: z.enum(["v0.6", "v0.7", "custom"]),
9395
customAccountFactoryAddress: z.string().optional(),
9496
})
@@ -108,6 +110,18 @@ export function AuthOptionsForm({ ecosystem }: { ecosystem: Ecosystem }) {
108110
path: ["customAccountFactoryAddress"],
109111
},
110112
)
113+
.refine(
114+
(data) => {
115+
if (data.useSmartAccount && (data.defaultChainId ?? 0) <= 0) {
116+
return false;
117+
}
118+
return true;
119+
},
120+
{
121+
message: "Please enter a valid chain ID",
122+
path: ["defaultChainId"],
123+
},
124+
)
111125
.refine(
112126
(data) => {
113127
if (data.useCustomAuth && !data.customAuthEndpoint) {

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/update-partner-modal.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function UpdatePartnerModal({
1919

2020
return (
2121
<Dialog open={open} onOpenChange={setOpen}>
22-
<DialogTrigger>{children}</DialogTrigger>
22+
<DialogTrigger asChild>{children}</DialogTrigger>
2323
<DialogContent className="z-[10001]" dialogOverlayClassName="z-[10000]">
2424
<DialogHeader className="mb-2">
2525
<DialogTitle>Update {partner.name}</DialogTitle>

0 commit comments

Comments
 (0)