-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve field label from key heuristics #5403
Conversation
🦋 Changeset detectedLatest commit: e561094 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/9j7YxUBNR6jWWcgCPN3qf5VEndXE |
e78e0ff
to
6abda2a
Compare
Yeah, this is a major because the label for lists that comes from keyToLabel is then passed through pluralize and then some more things happen to it and it ends up in the GraphQL API. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit e561094:
|
@mitchellhamilton mm, releasing a major for a slightly more correct label utility seems bad to me. At which point we can probably release this as a patch, provided the label in the |
…ze with humanize from utils package
ad72e94
to
cf43006
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a changeset
not at all, missed this when i removed logic :D Co-authored-by: Tim Leslie <timl@thinkmill.com.au>
…onejs/keystone into KEY-354/improve-heuristics
…onejs/keystone into KEY-354/improve-heuristics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Description
Field labels were previously using inflection to coerce the field key into a human readable label.
This caused incongruity with acronyms in particular. To address this we've done the following:
keyToLabel
utility in@keystone-next/keystone-legacy
to@keystone-next/utils-legacy
inflection
in the fields implementation with the newhumanize
utility.**The previous logic in keyToLabel would turn the following string
standardHTMLThing
toStandard HTMLThing
This is not consistent with the asserted behaviour, we've augmented this logic now to ensure the transformation is as follows:
standardHTMLThing
-->Standard HTML Thing
Before:
After:
I'm not really sure if this should be considered a breaking change or not, as I'm unclear if the label also affects non ui specific operations. (for example the returned value of keyToLabel is used both in pluralize and singularize in the list implementation)
perhaps @timleslie or @mitchellhamilton may have a semver suggestion here.
----- Edit ------
Removing the logic changes to keyToLabel / humanize, as this would be a major breaking change.
The field label logic should still be a drastic improvement from before.