Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions components/sections/apply-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const slugify = (s: string): string =>
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "")
.slice(0, 32)
// Re-strip a trailing hyphen if the 32-char cap landed on one. Without
// this second pass, slugify is non-idempotent — `slugify(slugify(x))`
// can differ from `slugify(x)`, which silently breaks the
// `state.slug === slugify(state.slug)` advance check below.
.replace(/-+$/g, "")

export function ApplyForm() {
const [state, setState] = useState<FormState>({
Expand Down