asgardeo / asgardeo/javascript

SignUp handleSubmit skipValidation parameter not exposed in TypeScript types

Offen Anfängerfreundlich
#485 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
18
Forks
67
Ø Merge
4 Std. 6 Min.
Gemergte PRs (30 T.)
13

Beschreibung

## Description

The `handleSubmit` function in the v2 SignUp/SignIn embedded flow components accepts a `skipValidation` third parameter, but this parameter is **not exposed in the TypeScript type definitions**. This makes it impossible for consumers using the render props pattern to skip validation for specific actions (e.g., social login triggers that don't need form inputs).

## Current Behavior

The runtime function signature supports `skipValidation`:

```javascript
// From compiled dist/index.js (~line 11844)
const handleSubmit = async (component, data, skipValidation) => {
if (!skipValidation) {
touchAllFields();
const validation = validateForm();
if (!validation.isValid) {
return;
}
}
// ... proceed with API call
};
```

But the TypeScript type in `BaseSignUpRenderProps` only declares:

```typescript
handleSubmit: (component: any, data?: Record) => Promise;
```

The third parameter is missing from the type, so TypeScript consumers don't know it exists and can't use it without `any` casting.

## Expected Behavior

The type should expose the `skipValidation` parameter:

```typescript
handleSubmit: (component: any, data?: Record, skipValidation?: boolean) => Promise;
```

This allows consumers to decide when validation should be skipped based on their own logic. For example, in Thunder's gate, social login trigger buttons skip validation since they don't use form inputs:

```tsx
onSubmit={(action, inputs) => {
const isTrigger = action.eventType === EmbeddedFlowEventType.Trigger;
void handleSubmit(action, inputs, isTrigger);
}}
```

## Affected Components

- **v2 SignUp (`BaseSignUp`)** — `BaseSignUpRenderProps.handleSubmit` type definition
- **v2 SignIn (`BaseSignIn`)** — equivalent render props type definition

Both have the `skipValidation` parameter in the runtime implementation but not in the types.

## Related

- Thunder issue: https://github.com/asgardeo/thunder/issues/2346

## Additional Context

- SDK version: `@asgardeo/react@0.23.1`
- The validation-skipping logic should remain a consumer decision, not an SDK-internal assumption — there are valid cases where trigger actions may still need form validation

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Durchsuche die TypeScript-Definitionen für BaseSignUpRenderProps und den entsprechenden BaseSignIn-Render-Props-Typ. Vergleiche deren handleSubmit-Deklarationen mit der im Issue beschriebenen Laufzeitsignatur, aktualisiere anschließend beide Deklarationen, damit sie den optionalen Parameter skipValidation offenlegen, und führe dann die relevanten Typprüfungen oder Tests aus, um zu bestätigen, dass Consumer das dritte Argument übergeben können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
react, typescript
Bereich
authentication, frontend
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
76/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.