File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -30481,11 +30481,15 @@
30481
30481
}, {
30482
30482
key: 'componentWillReceiveProps',
30483
30483
value: function componentWillReceiveProps(nextProps) {
30484
+ console.log("componentWillReceiveProps", this.props, nextProps);
30484
30485
if (this.isRequestPrettyPermalink(nextProps)) {
30486
+ console.log('isRequestPrettyPermalink');
30485
30487
this.props.fetchPost(nextProps.prettyPermalink);
30486
30488
} else if (this.isSearchRequest(nextProps)) {
30489
+ console.log('isSearchRequest');
30487
30490
this.props.searchSite(nextProps.searchTerm);
30488
30491
} else if (this.isRequestForIndex(nextProps)) {
30492
+ console.log('isRequestForIndex');
30489
30493
this.props.fetchPosts(nextProps.pageNum);
30490
30494
}
30491
30495
}
30502
30506
}, {
30503
30507
key: 'isRequestForIndex',
30504
30508
value: function isRequestForIndex(nextProps) {
30505
- return this.props.pageNum !== nextProps.pageNum || 'undefined' === typeof nextProps.prettyPermalink && 'undefined' === typeof nextProps.searchTerm;
30509
+ return this.props.pageNum !== nextProps.pageNum || 'undefined' === typeof nextProps.prettyPermalink && 'undefined' === typeof nextProps.searchTerm && (this.props.prettyPermalink !== nextProps.prettyPermalink || this.props.searchTerm !== nextProps.searchTerm) ;
30506
30510
}
30507
30511
}, {
30508
30512
key: 'componentWillMount',
Original file line number Diff line number Diff line change @@ -12,11 +12,15 @@ class Main extends Component {
12
12
}
13
13
14
14
componentWillReceiveProps ( nextProps ) {
15
+ console . log ( "componentWillReceiveProps" , this . props , nextProps ) ;
15
16
if ( this . isRequestPrettyPermalink ( nextProps ) ) {
17
+ console . log ( 'isRequestPrettyPermalink' ) ;
16
18
this . props . fetchPost ( nextProps . prettyPermalink ) ;
17
19
} else if ( this . isSearchRequest ( nextProps ) ) {
20
+ console . log ( 'isSearchRequest' ) ;
18
21
this . props . searchSite ( nextProps . searchTerm ) ;
19
22
} else if ( this . isRequestForIndex ( nextProps ) ) {
23
+ console . log ( 'isRequestForIndex' ) ;
20
24
this . props . fetchPosts ( nextProps . pageNum ) ;
21
25
}
22
26
}
@@ -31,7 +35,8 @@ class Main extends Component {
31
35
32
36
isRequestForIndex ( nextProps ) {
33
37
return this . props . pageNum !== nextProps . pageNum
34
- || ( 'undefined' === typeof nextProps . prettyPermalink && 'undefined' === typeof nextProps . searchTerm ) ;
38
+ || ( 'undefined' === typeof nextProps . prettyPermalink && 'undefined' === typeof nextProps . searchTerm )
39
+ && ( this . props . prettyPermalink !== nextProps . prettyPermalink || this . props . searchTerm !== nextProps . searchTerm ) ;
35
40
}
36
41
37
42
componentWillMount ( ) {
You can’t perform that action at this time.
0 commit comments