Skip to content

Commit 1f1e0c6

Browse files
feat: debounce username input to optimize async check (#8)
1 parent 642ec34 commit 1f1e0c6

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

package-lock.json

Lines changed: 21 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/registration-form-3/registration-form-3.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, inject, resource, signal } from '@angular/core';
2-
import { apply, applyEach, applyWhen, Field, disabled, email, FieldTree, form, maxLength, min, minLength, pattern, required, schema, submit, validate, validateAsync, validateTree, ValidationError, WithField } from '@angular/forms/signals';
2+
import { apply, applyEach, applyWhen, debounce, disabled, email, Field, FieldTree, form, maxLength, min, minLength, pattern, required, schema, submit, validate, validateAsync, validateTree, ValidationError, WithField } from '@angular/forms/signals';
33

44
import { BackButton } from '../back-button/back-button';
55
import { DebugOutput } from '../debug-output/debug-output';
@@ -35,6 +35,7 @@ export const formSchema = schema<RegisterFormData>((schemaPath) => {
3535
required(schemaPath.username, { message: 'Username is required' });
3636
minLength(schemaPath.username, 3, { message: 'A username must be at least 3 characters long' });
3737
maxLength(schemaPath.username, 12, { message: 'A username can be max. 12 characters long' });
38+
debounce(schemaPath.username, 500);
3839
validateAsync(schemaPath.username, {
3940
// Reactive params
4041
params: (ctx) => ctx.value(),

0 commit comments

Comments
 (0)