asgardeo / asgardeo/javascript

SignUp handleSubmit skipValidation parameter not exposed in TypeScript types

Aperta Adatta ai principianti
#485 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
18
Fork
67
Merge medio
4h 6m
PR unite (30g)
13

Descrizione

## 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Cerca le definizioni TypeScript di BaseSignUpRenderProps e del tipo equivalente di render-props di BaseSignIn. Confronta le relative dichiarazioni di handleSubmit con la firma a runtime descritta nell’issue, quindi aggiorna entrambe le dichiarazioni per esporre il parametro opzionale skipValidation ed esegui i controlli dei tipi o i test pertinenti per confermare che i consumer possano passare il terzo argomento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
react, typescript
Ambito
authentication, frontend
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
76/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.