Skip to content

Commit c7917e9

Browse files
authored
Fix data source slug update (#204)
When updating the new sanitized slug in form state it was compared with the unsanitized version of it in the local state of SlugInput component. This led to cases when the sanitized and unsanitized version being same, the changed slug was not updated in form state leading to it not being saved when 'Save' button on form was clicked. Comparing the local sanitized version with slug in the form state fixes it.
1 parent d71d03e commit c7917e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/data-sources/components/SlugInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const SlugInput: React.FC< SlugInputProps > = ( { slug, onChange, uuid }
2121
const debouncedCheckSlugConflict = useDebounce( checkSlugConflict, 500 );
2222
const onSlugUpdate = () => {
2323
const sanitizedSlug = slugify( newSlug ?? '' );
24-
if ( sanitizedSlug !== newSlug ) {
24+
if ( sanitizedSlug !== slug ) {
2525
setNewSlug( sanitizedSlug );
2626
onChange( sanitizedSlug );
2727
void debouncedCheckSlugConflict( sanitizedSlug, uuid ?? '' );

0 commit comments

Comments
 (0)