MCPcopy Create free account
hub / github.com/arctic-cli/interface / Diff

Function Diff

packages/ui/src/components/diff.tsx:12–46  ·  view source on GitHub ↗
(props: DiffProps<T>)

Source from the content-addressed store, hash-verified

10//
11
12export function Diff<T>(props: DiffProps<T>) {
13 let container!: HTMLDivElement
14 const [local, others] = splitProps(props, ["before", "after", "class", "classList", "annotations"])
15
16 const fileDiff = createMemo(
17 () =>
18 new FileDiff<T>(
19 {
20 ...createDefaultOptions(props.diffStyle),
21 ...others,
22 },
23 workerPool,
24 ),
25 )
26
27 const cleanupFunctions: Array<() => void> = []
28
29 createEffect(() => {
30 container.innerHTML = ""
31 fileDiff().render({
32 oldFile: local.before,
33 newFile: local.after,
34 lineAnnotations: local.annotations,
35 containerWrapper: container,
36 })
37 })
38
39 onCleanup(() => {
40 // Clean up FileDiff event handlers and dispose SolidJS components
41 fileDiff()?.cleanUp()
42 cleanupFunctions.forEach((dispose) => dispose())
43 })
44
45 return <div data-component="diff" style={styleVariables} ref={container} />
46}

Callers

nothing calls this directly

Calls 2

createDefaultOptionsFunction · 0.90
disposeFunction · 0.50

Tested by

no test coverage detected