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

[desk-tool] Fix issue where non-function child would fail to resolve #1325

Merged
merged 1 commit into from
May 24, 2019

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented May 22, 2019

The following structure fails to resolve the list:

import S from '@sanity/desk-tool/structure-builder'

export default S.list()
  .title('Content')
  .items([
    S.listItem()
      .title('Posts')
      .schemaType('post')
      .child(
        S.documentTypeList('category')
          .title('Posts by category')
          .child(S.list().title('test'))
      ),

    ...S.documentTypeListItems()
  ])

The following works:

import S from '@sanity/desk-tool/structure-builder'

export default S.list()
  .title('Content')
  .items([
    S.listItem()
      .title('Posts')
      .schemaType('post')
      .child(
        S.documentTypeList('category')
          .title('Posts by category')
          .child(() => S.list().title('test'))
      ),

    ...S.documentTypeListItems()
  ])

This was caused by us explicitly checking whether the child was a function, which it shouldn't have to be. Changed to only care about it being truthy or not.

@rexxars rexxars requested a review from thomax May 22, 2019 11:37
@rexxars rexxars merged commit 54f745c into next May 24, 2019
@rexxars rexxars deleted the fix-pane-resolving-err branch May 24, 2019 15:18
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

1 participant