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

Issue with creatableTypes Configuration in sanity3 Plugin #27

Open
lhoucinecherif opened this issue Sep 17, 2024 · 0 comments
Open

Issue with creatableTypes Configuration in sanity3 Plugin #27

lhoucinecherif opened this issue Sep 17, 2024 · 0 comments

Comments

@lhoucinecherif
Copy link

Describe the bug

I am experiencing an issue with the sanity3 plugin, specifically with the creatableTypes configuration in the createDeskHierarchy function. I want to prevent the "home" document type from being creatable, but the configuration does not seem to work as expected.

To Reproduce

Here is the configuration I am using:

const siteHierarchy = createDeskHierarchy({
  S,
  context,
  title: 'Site Structure',
  documentId: 'site-structure',
  referenceTo: ['home', 'page', 'project'],
  referenceOptions: {
    // Optional filters
  },
  icon: SchemaIcon,
  maxDept: 3,
  creatableTypes: ['page', 'project'] // 'home' is excluded
});

Expected behavior

The "home" document type should not be creatable within the hierarchy.

Actual Behavior:

Despite excluding "home" from the creatableTypes array, it is still possible to create documents of this type.

Steps to Reproduce:

1 - Configure the createDeskHierarchy as shown above.
2 - Attempt to create a new document within the hierarchy.
3 - Observe that the "home" document type is still creatable.

Which versions of Sanity are you using?

@sanity/cli (global) 3.52.0 (latest: 3.57.3)
@sanity/code-input 4.1.4 (up to date)
@sanity/color-input 3.1.1 (latest: 4.0.1)
@sanity/eslint-config-studio 3.0.1 (latest: 4.0.0)
@sanity/hierarchical-document-list 2.0.0 (up to date)
@sanity/icons 3.3.1 (latest: 3.4.0)
@sanity/vision 3.54.0 (latest: 3.57.3)
sanity 3.54.0 (latest: 3.57.3)

What operating system are you using?

Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy

Which versions of Node.js / npm are you running?

NPM 10.8.1
Node v20.15.0

Additional Context:

The "home" document type is configured as a singleton. This might be affecting the behavior of the creatableTypes configuration.

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