File tree Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {
15
15
getData ,
16
16
getOthersData ,
17
17
makeElementTree ,
18
- syncArr
18
+ patch
19
19
} from './utils' ;
20
20
import agent from './agent' ;
21
21
import Devtools from './components/Devtools' ;
@@ -99,7 +99,7 @@ devtools
99
99
/* eslint-disable no-unused-vars */
100
100
var oldArr = elementView . data . nodes ;
101
101
var newArr = makeElementTree ( nodes , [ ] ) ;
102
- elementView . data . nodes = syncArr ( oldArr , newArr , [ ] ) ;
102
+ elementView . data . nodes = patch ( oldArr , newArr ) ;
103
103
/* eslint-enable no-unused-vars */
104
104
elementView . $update ( ) ;
105
105
} )
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {enter, exit} from './inspectComponent';
12
12
import getData from './getData' ;
13
13
import getOthersData from './getOthersData' ;
14
14
import makeElementTree from './makeElementTree' ;
15
- import syncArr from './syncArr ' ;
15
+ import patch from './patch ' ;
16
16
17
17
export {
18
18
isPrimitive ,
@@ -31,7 +31,7 @@ export {
31
31
getData ,
32
32
getOthersData ,
33
33
makeElementTree ,
34
- syncArr ,
34
+ patch ,
35
35
enter ,
36
36
exit
37
37
} ;
Original file line number Diff line number Diff line change 1
1
import { findElementByUUIDNonRecursive } from "./findElement" ;
2
2
3
- export default function syncArr ( oldArr , newArr , container ) {
3
+ // reuse old nodes
4
+ export default function patch ( oldArr , newArr ) {
5
+ const container = [ ] ;
4
6
for ( var i = 0 ; i < newArr . length ; i ++ ) {
5
7
var newNode = newArr [ i ] ;
6
8
var oldNode = findElementByUUIDNonRecursive ( oldArr , newArr [ i ] . uuid ) ;
7
9
if ( oldNode ) {
8
10
if ( JSON . stringify ( oldNode ) !== JSON . stringify ( newNode ) ) {
9
11
oldNode . name = newNode . name ;
10
12
oldNode . isIncluded = newNode . isIncluded ;
11
- oldNode . childNodes = syncArr ( oldNode . childNodes , newNode . childNodes , [ ] ) ;
13
+ oldNode . childNodes = patch ( oldNode . childNodes , newNode . childNodes , [ ] ) ;
12
14
}
13
15
container . push ( oldNode ) ;
14
16
} else {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export default function(uuid) {
5
5
`devtoolsModel.print(${ JSON . stringify ( uuid ) } )` ,
6
6
function ( result , isException ) {
7
7
if ( isException ) {
8
- log ( "Inspect Error: " , isException ) ;
8
+ log ( "Print Error: " , isException ) ;
9
9
}
10
10
}
11
11
) ;
You can’t perform that action at this time.
0 commit comments