(props: Props)
| 19 | } |
| 20 | |
| 21 | export function DiffView(props: Props) { |
| 22 | const {diffOptions, thinFilePair} = props; |
| 23 | const [filePair, setFilePair] = React.useState<FilePair | null>(null); |
| 24 | |
| 25 | React.useEffect(() => { |
| 26 | (async () => { |
| 27 | const newFilePair = await getThickDiff(thinFilePair.idx); |
| 28 | setFilePair({ |
| 29 | ...newFilePair, |
| 30 | idx: thinFilePair.idx, |
| 31 | }); |
| 32 | })().catch((e: unknown) => { |
| 33 | console.error(e); |
| 34 | }); |
| 35 | }, [thinFilePair, setFilePair]); |
| 36 | |
| 37 | if (!filePair) { |
| 38 | return <div>Loading…</div>; |
| 39 | } |
| 40 | |
| 41 | let diffEl; |
| 42 | if (filePair.is_image_diff) { |
| 43 | diffEl = <ImageDiff filePair={filePair} {...props} />; |
| 44 | } else { |
| 45 | diffEl = ( |
| 46 | <CodeDiffContainer |
| 47 | filePair={filePair} |
| 48 | diffOptions={diffOptions} |
| 49 | normalizeJSON={props.normalizeJSON} |
| 50 | /> |
| 51 | ); |
| 52 | } |
| 53 | |
| 54 | return diffEl; |
| 55 | } |
nothing calls this directly
no test coverage detected