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

feat: add disableArrayWarning option to SlugOptions #7174

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

Stelkooo
Copy link

Description

Adds disableArrayWarning to the SlugOptions interface. Purpose is to allow users to disable the automatic array warning for slug fields within arrays.

Below is warning seen in the console.
image

Following the steps suggested by the warning works and stops the warning from showing up. However, if the developer creating the schema is using TypeScript they are hit with the following error
image

So adding disableArrayWarning removes that TS error.

Also a change to the schemaOptions const within the slugValidator.ts file as its type assertion is not needed due to disableArrayWarning is now included within the SlugOptions interface.

What to review

Review the changes to the SlugOptions interface found in the slug.ts file and to the defaultIsUnique function, specifically the schemaOptions variable. Ensure that when enabling disableArrayWarning` no TS error appears.

Testing

I did not add testing, I honestly do not know how but checking out the other slug functions and options I believe there is none. I have tested it with my own repos where I have used a slug field within an array.

Notes for release

This PR adds the disableArrayWarning option to the SlugOptions interface removing the TS error that appears when disableArrayWarning does not exist within the interface.

@Stelkooo Stelkooo requested a review from a team as a code owner July 16, 2024 23:59
@Stelkooo Stelkooo requested review from ricokahler and removed request for a team July 16, 2024 23:59
Copy link

vercel bot commented Jul 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2024 0:05am
performance-studio ✅ Ready (Inspect) Visit Preview Jul 17, 2024 0:05am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jul 17, 2024 0:05am

Copy link

vercel bot commented Jul 16, 2024

@Stelkooo is attempting to deploy a commit to the Sanity Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant