Skip to content
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

fix(schema): improve default title resolution for references #3049

Merged
merged 1 commit into from
Jan 11, 2022

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Jan 7, 2022

Description

When no title is given for a referenced document type, we currently default to the type name as-is, which makes the UI less user friendly (as pointed out in #3046).

This PR fixes it so that we display the referenced type in this order:

  • The title defined for the referenced type at the reference field/array item, if any
  • The title specified for the referenced document type, if any
  • A startCase'd version of the referenced document's type name (note: this follows from how we already resolve the default title for object types)

What to review

Verify that the UI displays titles of reference fields and array items in a user friendly way

Notes for release

  • Made the default title of referenced document types more user friendly

Fixes #3046

@vercel
Copy link

vercel bot commented Jan 7, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

perf-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/perf-studio/9skSHBGnukDJ6o93WEYKvaBpWgVc
✅ Preview: https://perf-studio-git-fix-improve-default-type-title-for-references.sanity.build

test-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/test-studio/DWmU81whtuHavR1yM4dBbve4VPdx
✅ Preview: https://test-studio-git-fix-improve-default-type-title-for-references.sanity.build

studio-workshop – ./dev/workshop

🔍 Inspect: https://vercel.com/sanity-io/studio-workshop/2F75TjvN1BpY46gxSyzfGYpRaDHb
✅ Preview: https://studio-workshop-git-fix-improve-default-type-title-for-r-f25e8d.sanity.build

Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a rebase, but looks good from what I can tell!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reference fields show the type name rather than the title
2 participants