1
1
const injectionStart = {
2
2
'16.6' : [
3
3
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type)' ,
4
- 'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type))'
4
+ 'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type, updateChild(child) ))'
5
5
] ,
6
6
'16.6-compact' : [
7
7
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.elementType===element.type)' ,
8
- 'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.elementType,element.type))'
8
+ 'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.elementType,element.type, updateChild(child) ))'
9
9
] ,
10
10
'16.4' : [
11
11
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {' ,
12
- 'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.type, element.type)) {'
12
+ 'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.type, element.type, updateChild(child) )) {'
13
13
] ,
14
14
'16.4-compact' : [
15
15
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.type===element.type)' ,
16
- 'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.type,element.type))'
16
+ 'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.type,element.type, updateChild(child) ))'
17
17
] ,
18
18
} ;
19
19
20
20
const additional = {
21
21
'16.6-update' : [
22
22
'if (current$$1 !== null && current$$1.elementType === element.type) {' ,
23
- 'if (current$$1 !== null && hotCompareElements(current$$1.elementType, element.type)) {'
23
+ 'if (current$$1 !== null && hotCompareElements(current$$1.elementType, element.type, updateChild(current$$1) )) {'
24
24
] ,
25
25
'16.6-update-compact' : [
26
26
'if(current$$1!==null&¤t$$1.elementType===element.type)' ,
27
- 'if(current$$1!==null&&hotCompareElements(current$$1.elementType,element.type))'
27
+ 'if(current$$1!==null&&hotCompareElements(current$$1.elementType,element.type,updateChild(current$$1) ))'
28
28
] ,
29
29
'16.4-update' : [
30
30
'if (current !== null && current.type === element.type) {' ,
31
- 'if (current !== null && hotCompareElements(current.type, element.type)) {'
31
+ 'if (current !== null && hotCompareElements(current.type, element.type, updateChild(current) )) {'
32
32
] ,
33
33
'16.4-update-compact' : [
34
34
'if (current!== null&¤t.type===element.type)' ,
35
- 'if (current!== null&&hotCompareElements(current.type,element.type))'
35
+ 'if (current!== null&&hotCompareElements(current.type,element.type,updateChild(current) ))'
36
36
]
37
37
} ;
38
38
39
39
const defaultEnd = [
40
40
'var ReactDOM = {' ,
41
- `
41
+ `var updateChild = function (child) { return function (newType) {
42
+ child.type = newType;
43
+ if (child.alternate) {
44
+ child.alternate.type = newType;
45
+ }
46
+ }};
42
47
var hotCompareElements = function (oldType, newType) { return oldType === newType };
43
48
var ReactDOM = {
44
49
setHotElementComparator: function (newComparator) { hotCompareElements = newComparator },
@@ -47,7 +52,12 @@ const defaultEnd = [
47
52
48
53
const defaultEndCompact = [
49
54
'var ReactDOM={' ,
50
- `
55
+ `var updateChild = function (child) { return function (newType) {
56
+ child.type = newType;
57
+ if (child.alternate) {
58
+ child.alternate.type = newType;
59
+ }
60
+ }};
51
61
var hotCompareElements = function (oldType, newType) { return oldType === newType };
52
62
var ReactDOM = {
53
63
setHotElementComparator: function (newComparator) { hotCompareElements = newComparator },
0 commit comments