11( function webpackUniversalModuleDefinition ( root , factory ) {
22 if ( typeof exports === 'object' && typeof module === 'object' )
3- module . exports = factory ( require ( "react" ) , require ( "react-dom " ) , require ( "react-dom/server" ) ) ;
3+ module . exports = factory ( require ( "react-dom " ) , require ( "react" ) , require ( "react-dom/server" ) ) ;
44 else if ( typeof define === 'function' && define . amd )
5- define ( [ "react" , "react-dom " , "react-dom/server" ] , factory ) ;
5+ define ( [ "react-dom " , "react" , "react-dom/server" ] , factory ) ;
66 else if ( typeof exports === 'object' )
7- exports [ "ReactRailsUJS" ] = factory ( require ( "react" ) , require ( "react-dom " ) , require ( "react-dom/server" ) ) ;
7+ exports [ "ReactRailsUJS" ] = factory ( require ( "react-dom " ) , require ( "react" ) , require ( "react-dom/server" ) ) ;
88 else
9- root [ "ReactRailsUJS" ] = factory ( root [ "React " ] , root [ "ReactDOM " ] , root [ "ReactDOMServer" ] ) ;
10- } ) ( this , function ( __WEBPACK_EXTERNAL_MODULE_3__ , __WEBPACK_EXTERNAL_MODULE_4__ , __WEBPACK_EXTERNAL_MODULE_5__ ) {
9+ root [ "ReactRailsUJS" ] = factory ( root [ "ReactDOM " ] , root [ "React " ] , root [ "ReactDOMServer" ] ) ;
10+ } ) ( this , function ( __WEBPACK_EXTERNAL_MODULE_1__ , __WEBPACK_EXTERNAL_MODULE_5__ , __WEBPACK_EXTERNAL_MODULE_6__ ) {
1111return /******/ ( function ( modules ) { // webpackBootstrap
1212/******/ // The module cache
1313/******/ var installedModules = { } ;
@@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap
7373/******/ __webpack_require__ . p = "" ;
7474/******/
7575/******/ // Load entry module and return exports
76- /******/ return __webpack_require__ ( __webpack_require__ . s = 6 ) ;
76+ /******/ return __webpack_require__ ( __webpack_require__ . s = 7 ) ;
7777/******/ } )
7878/************************************************************************/
7979/******/ ( [
@@ -106,13 +106,19 @@ module.exports = function(className) {
106106
107107/***/ } ) ,
108108/* 1 */
109+ /***/ ( function ( module , exports ) {
110+
111+ module . exports = __WEBPACK_EXTERNAL_MODULE_1__ ;
112+
113+ /***/ } ) ,
114+ /* 2 */
109115/***/ ( function ( module , exports , __webpack_require__ ) {
110116
111- var nativeEvents = __webpack_require__ ( 7 )
112- var pjaxEvents = __webpack_require__ ( 8 )
113- var turbolinksEvents = __webpack_require__ ( 9 )
114- var turbolinksClassicDeprecatedEvents = __webpack_require__ ( 11 )
115- var turbolinksClassicEvents = __webpack_require__ ( 10 )
117+ var nativeEvents = __webpack_require__ ( 8 )
118+ var pjaxEvents = __webpack_require__ ( 9 )
119+ var turbolinksEvents = __webpack_require__ ( 10 )
120+ var turbolinksClassicDeprecatedEvents = __webpack_require__ ( 12 )
121+ var turbolinksClassicEvents = __webpack_require__ ( 11 )
116122
117123// see what things are globally available
118124// and setup event handlers to those things
@@ -164,14 +170,14 @@ module.exports = function(ujs) {
164170
165171
166172/***/ } ) ,
167- /* 2 */
173+ /* 3 */
168174/***/ ( function ( module , exports , __webpack_require__ ) {
169175
170176// Make a function which:
171177// - First tries to require the name
172178// - Then falls back to global lookup
173179var fromGlobal = __webpack_require__ ( 0 )
174- var fromRequireContext = __webpack_require__ ( 12 )
180+ var fromRequireContext = __webpack_require__ ( 13 )
175181
176182module . exports = function ( reqctx ) {
177183 var fromCtx = fromRequireContext ( reqctx )
@@ -195,16 +201,41 @@ module.exports = function(reqctx) {
195201
196202
197203/***/ } ) ,
198- /* 3 */
199- /***/ ( function ( module , exports ) {
204+ /* 4 */
205+ /***/ ( function ( module , __webpack_exports__ , __webpack_require__ ) {
200206
201- module . exports = __WEBPACK_EXTERNAL_MODULE_3__ ;
207+ "use strict" ;
208+ Object . defineProperty ( __webpack_exports__ , "__esModule" , { value : true } ) ;
209+ /* harmony export (immutable) */ __webpack_exports__ [ "supportsHydration" ] = supportsHydration ;
210+ /* harmony export (immutable) */ __webpack_exports__ [ "reactHydrate" ] = reactHydrate ;
211+ /* harmony export (immutable) */ __webpack_exports__ [ "createReactRootLike" ] = createReactRootLike ;
212+ const ReactDOM = __webpack_require__ ( 1 )
202213
203- /***/ } ) ,
204- /* 4 */
205- /***/ ( function ( module , exports ) {
214+ function supportsHydration ( ) {
215+ return typeof ReactDOM . hydrate === "function" || typeof ReactDOM . hydrateRoot === "function"
216+ }
217+
218+ function reactHydrate ( node , component ) {
219+ if ( typeof ReactDOM . hydrateRoot === "function" ) {
220+ return ReactDOM . hydrateRoot ( node , component )
221+ } else {
222+ return ReactDOM . hydrate ( component , node )
223+ }
224+ }
225+
226+ function createReactRootLike ( node ) {
227+ return ReactDOM . createRoot ? ReactDOM . createRoot ( node ) : legacyReactRootLike ( node )
228+ }
229+
230+ function legacyReactRootLike ( node ) {
231+ const root = {
232+ render ( component ) {
233+ return ReactDOM . render ( component , node )
234+ }
235+ }
236+ return root
237+ }
206238
207- module . exports = __WEBPACK_EXTERNAL_MODULE_4__ ;
208239
209240/***/ } ) ,
210241/* 5 */
@@ -214,15 +245,22 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_5__;
214245
215246/***/ } ) ,
216247/* 6 */
248+ /***/ ( function ( module , exports ) {
249+
250+ module . exports = __WEBPACK_EXTERNAL_MODULE_6__ ;
251+
252+ /***/ } ) ,
253+ /* 7 */
217254/***/ ( function ( module , exports , __webpack_require__ ) {
218255
219- var React = __webpack_require__ ( 3 )
220- var ReactDOM = __webpack_require__ ( 4 )
221- var ReactDOMServer = __webpack_require__ ( 5 )
256+ var React = __webpack_require__ ( 5 )
257+ var ReactDOM = __webpack_require__ ( 1 )
258+ var ReactDOMServer = __webpack_require__ ( 6 )
222259
223- var detectEvents = __webpack_require__ ( 1 )
260+ var detectEvents = __webpack_require__ ( 2 )
224261var constructorFromGlobal = __webpack_require__ ( 0 )
225- var constructorFromRequireContextWithGlobalFallback = __webpack_require__ ( 2 )
262+ var constructorFromRequireContextWithGlobalFallback = __webpack_require__ ( 3 )
263+ const { supportsHydration, reactHydrate, createReactRootLike } = __webpack_require__ ( 4 )
226264
227265var ReactRailsUJS = {
228266 // This attribute holds the name of component which should be mounted
@@ -329,13 +367,14 @@ var ReactRailsUJS = {
329367 }
330368 }
331369
332- if ( hydrate && typeof ReactDOM . hydrate === "function" ) {
333- component = ReactDOM . hydrate ( component , node ) ;
370+ if ( hydrate && supportsHydration ( ) ) {
371+ component = reactHydrate ( node , component ) ;
334372 } else {
335- component = ReactDOM . render ( component , node ) ;
373+ const root = createReactRootLike ( node )
374+ component = root . render ( component ) ;
336375 }
337376 }
338- }
377+ }
339378 } ,
340379
341380 // Within `searchSelector`, find nodes which have React components
@@ -390,7 +429,7 @@ module.exports = ReactRailsUJS
390429
391430
392431/***/ } ) ,
393- /* 7 */
432+ /* 8 */
394433/***/ ( function ( module , exports ) {
395434
396435module . exports = {
@@ -413,7 +452,7 @@ module.exports = {
413452
414453
415454/***/ } ) ,
416- /* 8 */
455+ /* 9 */
417456/***/ ( function ( module , exports ) {
418457
419458module . exports = {
@@ -433,25 +472,23 @@ module.exports = {
433472
434473
435474/***/ } ) ,
436- /* 9 */
475+ /* 10 */
437476/***/ ( function ( module , exports ) {
438477
439478module . exports = {
440479 // Turbolinks 5+ got rid of named events (?!)
441480 setup : function ( ujs ) {
442481 ujs . handleEvent ( 'turbolinks:load' , ujs . handleMount ) ;
443- ujs . handleEvent ( 'turbolinks:before-render' , ujs . handleUnmount ) ;
444482 } ,
445483
446484 teardown : function ( ujs ) {
447485 ujs . removeEvent ( 'turbolinks:load' , ujs . handleMount ) ;
448- ujs . removeEvent ( 'turbolinks:before-render' , ujs . handleUnmount ) ;
449486 } ,
450487}
451488
452489
453490/***/ } ) ,
454- /* 10 */
491+ /* 11 */
455492/***/ ( function ( module , exports ) {
456493
457494module . exports = {
@@ -469,7 +506,7 @@ module.exports = {
469506
470507
471508/***/ } ) ,
472- /* 11 */
509+ /* 12 */
473510/***/ ( function ( module , exports ) {
474511
475512module . exports = {
@@ -490,7 +527,7 @@ module.exports = {
490527
491528
492529/***/ } ) ,
493- /* 12 */
530+ /* 13 */
494531/***/ ( function ( module , exports ) {
495532
496533// Load React components by requiring them from "components/", for example:
0 commit comments