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

[form-builder] Show warning for array items without _type #2020

Merged
merged 1 commit into from
Sep 22, 2020

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Sep 21, 2020

Type of change (check at least one)

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or update to documentation)
  • Maintenance
  • Other, please describe:

Does this change require a documentation update? (Check one)

  • Yes
  • No

Current behavior

If an array member type has a name, but array items exist that do not have a _type, they are silently hidden.

Example: https://test-studio-git-next.sanity-io.now.sh/test/desk/arraysTest;untyped-objects

  • "Array of multiple types" actually has one array item, but is not displayed

Description

This PR checks for the case when a member type cannot be found.

  • If there is only a single member type that is valid, it renders an option to set the type name
  • If there are multiple member types that are valid, it renders the possible types and an option to remove the item

Example: https://test-studio-git-fix-array-missing-type.sanity-io.now.sh/test/desk/arraysTest;untyped-objects

Note for release

  • Fixed bug where objects in arrays without a _type property would not be displayed

Checklist

  • I have read the Contributing Guidelines
  • The PR title includes a link to the relevant issue
  • The PR title is appropriately formatted: [some-package] PR title (#123)
  • The code is linted
  • The test suite is passing
  • Corresponding changes to the documentation have been made

@vercel
Copy link

vercel bot commented Sep 21, 2020

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/sanity-io/test-studio/r1btnmqak
✅ Preview: https://test-studio-git-fix-array-missing-type.sanity-io.vercel.app

@rexxars rexxars changed the title [form-builder] Show warning for array items without _type [form-builder] Show warning for array items without _type Sep 22, 2020
Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@rexxars rexxars merged commit 78d88e8 into next Sep 22, 2020
@rexxars rexxars deleted the fix-array-missing-type branch September 22, 2020 08:24
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.

None yet

2 participants