@@ -11,6 +11,32 @@ exports.createComponent_ = function(
1111 identityEventFn ,
1212 displayName
1313) {
14+ var defaultInitialState = null ;
15+ var defaultShouldUpdate = function ( ) {
16+ return function ( ) {
17+ return function ( ) {
18+ return true ;
19+ } ;
20+ } ;
21+ } ;
22+ var defaultDidMount = function ( ) {
23+ return function ( ) { } ;
24+ } ;
25+ var defaultDidUpdate = function ( ) {
26+ return function ( ) { } ;
27+ } ;
28+ var defaultWillUnmount = function ( ) {
29+ return function ( ) { } ;
30+ } ;
31+ var defaultUpdate = function ( ) {
32+ return function ( ) {
33+ return noUpdate ;
34+ } ;
35+ } ;
36+ var defaultRender = function ( ) {
37+ return false ;
38+ } ;
39+
1440 function contextToSelf ( instance ) {
1541 var self = {
1642 props : instance . props . $$props ,
@@ -24,7 +50,10 @@ exports.createComponent_ = function(
2450 } ,
2551 send : function ( action ) {
2652 return function ( ) {
27- if ( ! self . instance_ . $$mounted ) {
53+ if (
54+ ! self . instance_ . $$mounted ||
55+ self . instance_ . $$spec . update === defaultUpdate
56+ ) {
2857 return ;
2958 }
3059 var sideEffects = null ;
@@ -77,32 +106,6 @@ exports.createComponent_ = function(
77106 return self ;
78107 }
79108
80- var defaultInitialState = null ;
81- var defaultShouldUpdate = function ( ) {
82- return function ( ) {
83- return function ( ) {
84- return true ;
85- } ;
86- } ;
87- } ;
88- var defaultDidMount = function ( ) {
89- return function ( ) { } ;
90- } ;
91- var defaultDidUpdate = function ( ) {
92- return function ( ) { } ;
93- } ;
94- var defaultWillUnmount = function ( ) {
95- return function ( ) { } ;
96- } ;
97- var defaultUpdate = function ( ) {
98- return function ( ) {
99- return noUpdate ;
100- } ;
101- } ;
102- var defaultRender = function ( ) {
103- return false ;
104- } ;
105-
106109 var Component = function constructor ( props ) {
107110 this . $$mounted = true ;
108111 this . $$spec = props . $$spec ;
@@ -121,26 +124,38 @@ exports.createComponent_ = function(
121124 Component . displayName = displayName ;
122125
123126 Component . prototype . shouldComponentUpdate = function ( nextProps , nextState ) {
124- return this . $$spec . shouldUpdate ( {
125- props : this . props . $$props ,
126- state : this . state === null ? null : this . state . $$state
127- } ) ( nextProps . $$props ) ( nextState === null ? null : nextState . $$state ) ;
127+ var shouldUpdate = this . $$spec . shouldUpdate ;
128+ return shouldUpdate === defaultShouldUpdate
129+ ? true
130+ : shouldUpdate ( {
131+ props : this . props . $$props ,
132+ state : this . state === null ? null : this . state . $$state
133+ } ) ( nextProps . $$props ) ( nextState === null ? null : nextState . $$state ) ;
128134 } ;
129135
130136 Component . prototype . componentDidMount = function ( ) {
131- return this . $$spec . didMount ( contextToSelf ( this ) ) ( ) ;
137+ var didMount = this . $$spec . didMount ;
138+ if ( didMount !== defaultDidMount ) {
139+ this . $$spec . didMount ( contextToSelf ( this ) ) ( ) ;
140+ }
132141 } ;
133142
134143 Component . prototype . componentDidUpdate = function ( ) {
135- return this . $$spec . didUpdate ( contextToSelf ( this ) ) ( ) ;
144+ var didUpdate = this . $$spec . didUpdate ;
145+ if ( didUpdate !== defaultDidUpdate ) {
146+ didUpdate ( contextToSelf ( this ) ) ( ) ;
147+ }
136148 } ;
137149
138150 Component . prototype . componentWillUnmount = function ( ) {
139151 this . $$mounted = false ;
140- return this . $$spec . willUnmount ( {
141- props : this . props . $$props ,
142- state : this . state === null ? null : this . state . $$state
143- } ) ( ) ;
152+ var willUnmount = this . $$spec . willUnmount ;
153+ if ( willUnmount !== defaultWillUnmount ) {
154+ willUnmount ( {
155+ props : this . props . $$props ,
156+ state : this . state === null ? null : this . state . $$state
157+ } ) ( ) ;
158+ }
144159 } ;
145160
146161 Component . prototype . render = function ( ) {
0 commit comments