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 custom pair fields examples (#8663) #8664

Merged
merged 1 commit into from Jul 4, 2023

Conversation

gathanase
Copy link
Contributor

@gathanase gathanase commented Jul 3, 2023

@changeset-bot
Copy link

changeset-bot bot commented Jul 3, 2023

⚠️ No Changeset found

Latest commit: f42430b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 3, 2023

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 f42430b:

Sandbox Source
@keystone-6/sandbox Configuration

@@ -44,6 +44,7 @@ export function pair<ListTypeInfo extends BaseListTypeInfo>(
config: PairFieldConfig<ListTypeInfo> = {}
): FieldTypeFunc<ListTypeInfo> {
function resolveInput(value: PairInput | null | undefined) {
if (!value) return undefined;
Copy link
Member

@dcousens dcousens Jul 4, 2023

Choose a reason for hiding this comment

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

@gathanase thanks for making the changes, but I think this might want to be specifically

if (value === undefined) return undefined

null is a value users might want to use and put in the database, whereas undefined means "unchanged".
I might be wrong, but that's my understanding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the user want to put null in database then we should return null if value is null. In any case, I think you are right that we should only consider undefined.

@dcousens
Copy link
Member

dcousens commented Jul 4, 2023

Thanks @gathanase! 💛

@dcousens dcousens merged commit 3ebc53e into keystonejs:main Jul 4, 2023
4 of 5 checks passed
dcousens added a commit that referenced this pull request Jul 9, 2023
dcousens added a commit that referenced this pull request Jul 9, 2023
dcousens added a commit that referenced this pull request Jul 9, 2023
Co-authored-by: Daniel Cousens <dcousens@users.noreply.github.com>
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.

Example pair custom fields are reset if not changed during update
2 participants