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 relationship field not respecting ui.displayMode: cards in create view #6967

Conversation

emmatown
Copy link
Member

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, and ui.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.

@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2021

🦋 Changeset detected

Latest commit: b2b3f94

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@keystone-next/keystone Patch

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

@vercel
Copy link

vercel bot commented Nov 18, 2021

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

🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/GqAmqNzadhEcQiJ3ZQoPJBw1gytX
✅ Preview: https://keystone-next-docs-git-fix-relationship-field-8665e9-keystonejs.vercel.app

@codesandbox-ci
Copy link

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.

@emmatown emmatown marked this pull request as ready for review November 18, 2021 05:07
@emmatown emmatown requested a review from gwyneplaine November 18, 2021 05:07
field: ReturnType<typeof controller> & { display: { mode: 'cards' } };
id: string;
forceValidation: boolean | undefined;
id: string | null;
value: { kind: 'cards-view' };
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

@gwyneplaine gwyneplaine left a comment

Choose a reason for hiding this comment

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

lgtm

@emmatown emmatown merged commit 4e96c23 into main Nov 19, 2021
@emmatown emmatown deleted the fix-relationship-field-not-respecting-ui-display-mode-cards-in-create-view branch November 19, 2021 03:09
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.

2 participants