Skip to content

Commit 82578ea

Browse files
rexxarsbjoerge
authored andcommitted
[schema] Fix error in slug validation when current is not set (#648)
1 parent c9af1b1 commit 82578ea

File tree

1 file changed

+4
-0
lines changed
  • packages/@sanity/schema/src/legacy/types

1 file changed

+4
-0
lines changed

packages/@sanity/schema/src/legacy/types/slug.js

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ const SLUG_CORE = {
5555
return true
5656
}
5757

58+
if (!value.current) {
59+
return 'Slug must have a value'
60+
}
61+
5862
const errorMessage = 'Slug is already in use'
5963
const isUnique = get(options, 'type.options.isUnique', defaultIsUnique)
6064
return Promise.resolve(isUnique(value.current, {...options, defaultIsUnique})).then(

0 commit comments

Comments
 (0)