-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 relationship field not respecting ui.displayMode: cards in create view #6967
Fix relationship field not respecting ui.displayMode: cards in create view #6967
Conversation
🦋 Changeset detectedLatest commit: b2b3f94 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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/GqAmqNzadhEcQiJ3ZQoPJBw1gytX |
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. |
field: ReturnType<typeof controller> & { display: { mode: 'cards' } }; | ||
id: string; | ||
forceValidation: boolean | undefined; | ||
id: string | null; | ||
value: { kind: 'cards-view' }; |
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.
@mitchellhamilton curiosity: Is there value in providing a more explicit type here, or is this purely for type narrowing purposes?
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.
It's to narrow the type
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
I also ended up refactoring some things to avoid awkward type things because what the display mode is was represented in two places and the
Field
view needed to access both of them.Note the relationship field doesn't respect
ui.displayMode: 'count'
on the create view and this doesn't change that, I think that's fine and good given that would just mean showing nothing, andui.displayMode: 'count'
just exists because our other UIs are bad at handling relationships with a lot of related items so we might as well give users a better UI when we know that it's okay.