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

Creating a new document is not possible for a documentList with children #8861

Open
samimakela opened this issue Mar 7, 2025 · 0 comments
Open

Comments

@samimakela
Copy link

samimakela commented Mar 7, 2025

Describe the bug

When clicking "Create new document" in a documentList pane with a child, the child pane will open instead of the document editor.

This is problematic because a lot of Sanity documentation instructs to build filtered lists like this. E.g. https://www.sanity.io/docs/structure-builder-cheat-sheet#68ee42d8c7a5

To Reproduce

Steps to reproduce the behavior in test-studio.

  1. Click 'Custom panes'
  2. Click 'Books by author'
  3. Click '+' icon next to author
  4. Click 'Author'

Expected behavior

Expected the document editor to be opened. Please compare to behaviour with the following steps in test-studio.

  1. Click 'Custom panes'
  2. Click 'Authors & Books'
  3. Click '+' icon next to 'Authors & Books'
  4. Click 'Author'

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here.

@sanity/cli (global) 3.78.0 (latest: 3.78.1)
@sanity/eslint-config-i18n 1.0.0 (latest: 1.1.0)
@sanity/eslint-config-studio 4.0.0 (latest: 5.0.2)
@sanity/mutate 0.12.1 (up to date)
@sanity/pkg-utils 6.13.4 (latest: 7.0.4)
@sanity/prettier-config 1.0.3 (up to date)
@sanity/test 0.0.1-alpha.1 (up to date)
@sanity/tsdoc 1.0.169 (latest: 2.0.9)
@sanity/ui 2.15.2 (up to date)
@sanity/uuid 3.0.2 (up to date)
sanity 3.78.1 (up to date)

Additional context

getIntentState() in packages/sanity/src/structure/getIntentState.ts seems to expect that all documentLists with matching type and filter are able to handle the create intent. This is not the case if the documentList has children as the steps to reproduce mentioned above shows.

Adding && pane.child === undefined to the statement seems to fix the issue.

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

No branches or pull requests

1 participant