<commit_before>import React from 'react'
import {ObjectDiff, StringDiff} from '@sanity/diff'
import {Annotation} from '../../panes/documentPane/history/types'
import {DiffComponent, SchemaType} from '../types'
import {StringFieldDiff} from '../string/StringFieldDiff'

interface Slug {
  current?: string
}

export const SlugFieldDiff: DiffComponent<ObjectDiff<Annotation>> = ({diff, schemaType}) => {
  const currentField = schemaType.fields?.find(field => field.name === 'current')
  const currentDiff = diff.fields.current
  if (!currentField || currentDiff?.action !== 'changed' || currentDiff?.type !== 'string') {
    return null
  }

  return (
    <StringFieldDiff
      diff={currentDiff}
      schemaType={currentField as SchemaType<StringDiff<Annotation>>}
    />
  )
}<commit_msg>[desk-tool] Fix slug diff not rendering unless changed<commit_after>import React from 'react'
import {ObjectDiff, StringDiff} from '@sanity/diff'
import {Annotation} from '../../panes/documentPane/history/types'
import {DiffComponent, SchemaType} from '../types'
import {StringFieldDiff} from '../string/StringFieldDiff'

interface Slug {
  current?: string
}

export const SlugFieldDiff: DiffComponent<ObjectDiff<Annotation>> = ({diff, schemaType}) => {
  const currentField = schemaType.fields?.find(field => field.name === 'current')
  const currentDiff = diff.fields.current
  if (!currentField || currentDiff?.type !== 'string') {
    return null
  }

  return (
    <StringFieldDiff
      diff={currentDiff}
      schemaType={currentField as SchemaType<StringDiff<Annotation>>}
    />
  )
}
{'fraction_non_alphanumeric': 0.14105793450881612, 'fraction_numerical': 0.0, 'mean_word_length': 4.675, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2650618', 'n_tokens_mistral': 449, 'n_tokens_neox': 445, 'n_words': 113}