CodeForPhilly / CodeForPhilly/codeforphilly-ng

Cleaner slug-availability debounce pattern under react-hooks v7

Abierto
#40 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
1
Forks
1
Merge medio
5 d 3 h
PR fusionados (30 d)
9

Descripción

Follow-up from [#38](https://github.com/CodeForPhilly/codeforphilly-ng/pull/38) (authoring-screens).

In `apps/web/src/screens/ProjectEdit.tsx`, the debounced slug-availability check now sets `setSlugAvailability('checking')` *inside* the `setTimeout` callback rather than at the start of the effect. That's because eslint-plugin-react-hooks v7's `set-state-in-effect` rule flags every setState reachable from the effect body. The pattern still works, but the visual 'Checking…' indicator is delayed by the debounce (400ms) rather than appearing immediately after typing.

### Options

- Add a small `useDebounce` hook that owns its own state and emits a debounced value the effect can react to without setting state synchronously
- Use `useEffectEvent` (still experimental) once it lands stable
- Mark the early `setSlugAvailability('checking')` with a targeted `eslint-disable` if we decide the UX win is worth the rule exception

Either way, low-priority polish — the form is fully functional today.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.