feat(payload-helper): Add reusable Slug field helper#424
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
SlugFieldhelper to standardise slug generation and admin UI across collections and reduce duplicated slug logic.Description
Slugfield helper underpackages/payload-helper/src/fields/Slugthat returns a[TextField, CheckboxField]pair and supports overrides viaslugOverridesandcheckboxOverrides.formatSlugandformatSlugHookinformatSlug.tsto automatically format fallback values into URL-friendly slugs duringbeforeValidate.Component.tsxand stylesheetindex.scssto provide a lock/unlock UI for auto-generated slugs, and wire the component via the fieldadmin.components.Fieldclient path.SlugFieldand related types frompackages/payload-helper/src/fields/index.tsand re-export from the package rootsrc/index.ts, and add a Changeset (.changeset/fresh-turkeys-bathe.md) marking a minor feature bump for@ainsleydev/payload-helper.Testing
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.Codex Task