Skip to content

feat(payload-helper): Add reusable Slug field helper#424

Merged
ainsleyclark merged 3 commits into
mainfrom
codex/add-slug-field-to-payload-helper
Mar 13, 2026
Merged

feat(payload-helper): Add reusable Slug field helper#424
ainsleyclark merged 3 commits into
mainfrom
codex/add-slug-field-to-payload-helper

Conversation

@ainsleyclark
Copy link
Copy Markdown
Contributor

Motivation

  • Provide a reusable SlugField helper to standardise slug generation and admin UI across collections and reduce duplicated slug logic.

Description

  • Add a new Slug field helper under packages/payload-helper/src/fields/Slug that returns a [TextField, CheckboxField] pair and supports overrides via slugOverrides and checkboxOverrides.
  • Add formatSlug and formatSlugHook in formatSlug.ts to automatically format fallback values into URL-friendly slugs during beforeValidate.
  • Add a lockable React admin component Component.tsx and stylesheet index.scss to provide a lock/unlock UI for auto-generated slugs, and wire the component via the field admin.components.Field client path.
  • Export SlugField and related types from packages/payload-helper/src/fields/index.ts and re-export from the package root src/index.ts, and add a Changeset (.changeset/fresh-turkeys-bathe.md) marking a minor feature bump for @ainsleydev/payload-helper.

Testing

  • Attempted to run formatting via pnpm --filter @ainsleydev/payload-helper format, but this failed due to an environment package-manager bootstrap/network tunnel error (HTTP 403), so formatting/type-build steps were not completed.
  • No automated unit tests were executed in this environment after the change; the changes were committed successfully.

Codex Task

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.26%. Comparing base (7f6b060) to head (a2a8b19).
⚠️ Report is 508 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #424      +/-   ##
==========================================
+ Coverage   64.59%   70.26%   +5.67%     
==========================================
  Files         154      187      +33     
  Lines        6064     7439    +1375     
==========================================
+ Hits         3917     5227    +1310     
+ Misses       2064     2012      -52     
- Partials       83      200     +117     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ainsleyclark ainsleyclark marked this pull request as ready for review March 13, 2026 07:51
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@ainsleyclark ainsleyclark changed the title feat(payload-helper): add reusable Slug field helper feat(payload-helper): Add reusable Slug field helper Mar 13, 2026
@ainsleyclark ainsleyclark merged commit fe26c53 into main Mar 13, 2026
3 of 4 checks passed
@ainsleyclark ainsleyclark deleted the codex/add-slug-field-to-payload-helper branch March 13, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant