@@ -2,7 +2,7 @@ import React from 'react';
2
2
import { diff , formatters } from 'jsondiffpatch' ;
3
3
import ReactHtmlParser from 'react-html-parser' ;
4
4
import { useStoreContext } from '../store' ;
5
- import { DiffProps , StatelessCleanning } from '../FrontendTypes' ;
5
+ import { DiffProps , StatelessCleaning } from '../FrontendTypes' ;
6
6
7
7
/**
8
8
* Displays tree showing specific two versions of tree
@@ -26,7 +26,7 @@ function Diff(props: DiffProps): JSX.Element {
26
26
}
27
27
28
28
// cleaning preview from stateless data
29
- const statelessCleanning = ( obj : StatelessCleanning ) => {
29
+ const statelessCleaning = ( obj : StatelessCleaning ) => {
30
30
const newObj = { ...obj } ;
31
31
if ( newObj . name === 'nameless' ) {
32
32
delete newObj . name ;
@@ -38,15 +38,15 @@ function Diff(props: DiffProps): JSX.Element {
38
38
delete newObj . state ;
39
39
}
40
40
if ( newObj . stateSnaphot ) {
41
- newObj . stateSnaphot = statelessCleanning ( obj . stateSnaphot ) ;
41
+ newObj . stateSnaphot = statelessCleaning ( obj . stateSnaphot ) ;
42
42
}
43
43
if ( newObj . children ) {
44
44
newObj . children = [ ] ;
45
45
if ( obj . children . length > 0 ) {
46
46
obj . children . forEach (
47
47
( element : { state ?: Record < string , unknown > | string ; children ?: [ ] } ) => {
48
48
if ( element . state !== 'stateless' || element . children . length > 0 ) {
49
- const clean = statelessCleanning ( element ) ;
49
+ const clean = statelessCleaning ( element ) ;
50
50
newObj . children . push ( clean ) ;
51
51
}
52
52
} ,
@@ -57,20 +57,21 @@ function Diff(props: DiffProps): JSX.Element {
57
57
} ;
58
58
59
59
// displays stateful data
60
- const previousDisplay : StatelessCleanning = statelessCleanning ( previous ) ;
60
+ const previousDisplay : StatelessCleaning = statelessCleaning ( previous ) ;
61
61
// diff function returns a comparison of two objects, one has an updated change
62
62
// just displays stateful data
63
- const delta : StatelessCleanning = diff ( previousDisplay , snapshot ) ;
63
+ const delta : StatelessCleaning = diff ( previousDisplay , snapshot ) ;
64
64
// returns html in string
65
65
// just displays stateful data
66
- const html : StatelessCleanning = formatters . html . format ( delta , previousDisplay ) ;
66
+ const html : StatelessCleaning = formatters . html . format ( delta , previousDisplay ) ;
67
67
if ( show ) formatters . html . showUnchanged ( ) ;
68
68
else formatters . html . hideUnchanged ( ) ;
69
69
if ( previous === undefined || delta === undefined ) {
70
70
return (
71
71
< div className = 'no-data-message' >
72
72
{ ' ' }
73
- Make state changes and click on a Snapshot to see the difference between that snapshot and the previous one.{ ' ' }
73
+ Make state changes and click on a Snapshot to see the difference between that snapshot and
74
+ the previous one.{ ' ' }
74
75
</ div >
75
76
) ;
76
77
}
0 commit comments