CodeForPhilly / CodeForPhilly/codeforphilly-ng

Cleaner slug-availability debounce pattern under react-hooks v7

オープン
#40 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
1
フォーク
1
平均マージ
5日 3時間
マージ済み PR(30日)
9

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。