@@ -31,9 +31,6 @@ var eventListenerOptions = {
31
31
capture : true ,
32
32
passive : true
33
33
} ;
34
- var defaultWrapperStyle = {
35
- display : "inline-block"
36
- } ;
37
34
38
35
var getDisplayName = function getDisplayName ( WrappedComponent ) {
39
36
return WrappedComponent . displayName || WrappedComponent . name || "Component" ;
@@ -44,8 +41,7 @@ var withHydrationOnDemandServerSide = function withHydrationOnDemandServerSide(W
44
41
var wrapperProps = _ref . wrapperProps ,
45
42
props = ( 0 , _objectWithoutProperties2 [ "default" ] ) ( _ref , [ "wrapperProps" ] ) ;
46
43
return _react [ "default" ] . createElement ( "section" , ( 0 , _extends2 [ "default" ] ) ( {
47
- "data-hydration-on-demand" : true ,
48
- style : defaultWrapperStyle
44
+ "data-hydration-on-demand" : true
49
45
} , wrapperProps ) , _react [ "default" ] . createElement ( WrappedComponent , props ) ) ;
50
46
} ;
51
47
} ;
@@ -118,7 +114,10 @@ var withHydrationOnDemandClientSide = function withHydrationOnDemandClientSide(_
118
114
} ( ) ;
119
115
120
116
var initDOMEvent = function initDOMEvent ( type ) {
121
- var target = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : rootRef . current ;
117
+ var getTarget = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : function ( ) {
118
+ return rootRef . current ;
119
+ } ;
120
+ var target = getTarget ( ) ;
122
121
target . addEventListener ( type , hydrate , eventListenerOptions ) ;
123
122
cleanupFunctions . current . push ( function ( ) {
124
123
target . removeEventListener ( type , hydrate , eventListenerOptions ) ;
@@ -153,12 +152,15 @@ var withHydrationOnDemandClientSide = function withHydrationOnDemandClientSide(_
153
152
} ) ;
154
153
} ;
155
154
156
- var initIntersectionObserver = function initIntersectionObserver ( options ) {
155
+ var initIntersectionObserver = function initIntersectionObserver ( ) {
156
+ var getOptions = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : Function . prototype ;
157
+
157
158
if ( ! ( "IntersectionObserver" in window ) ) {
158
159
hydrate ( ) ;
159
160
return ;
160
161
}
161
162
163
+ var options = getOptions ( ) ;
162
164
new IntersectionObserver ( function ( _ref5 , observer ) {
163
165
var _ref6 = ( 0 , _slicedToArray2 [ "default" ] ) ( _ref5 , 1 ) ,
164
166
entry = _ref6 [ 0 ] ;
@@ -205,12 +207,9 @@ var withHydrationOnDemandClientSide = function withHydrationOnDemandClientSide(_
205
207
dangerouslySetInnerHTML : {
206
208
__html : ""
207
209
} ,
208
- suppressHydrationWarning : true ,
209
- style : defaultWrapperStyle
210
+ suppressHydrationWarning : true
210
211
} , wrapperProps ) ) ;
211
- return _react [ "default" ] . createElement ( "section" , ( 0 , _extends2 [ "default" ] ) ( {
212
- style : defaultWrapperStyle
213
- } , wrapperProps ) , _react [ "default" ] . createElement ( WrappedComponent , props ) ) ;
212
+ return _react [ "default" ] . createElement ( "section" , wrapperProps , _react [ "default" ] . createElement ( WrappedComponent , props ) ) ;
214
213
} ;
215
214
216
215
WithHydrationOnDemand . displayName = "withHydrationOnDemand(" . concat ( getDisplayName ( WrappedComponent ) , ")" ) ;
0 commit comments