Skip to content

Commit 344ba13

Browse files
committed
Apply UJS update change
1 parent 10e767a commit 344ba13

File tree

3 files changed

+114
-111
lines changed

3 files changed

+114
-111
lines changed

lib/assets/javascripts/react_ujs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ var ReactRailsUJS = {
321321
}
322322
throw new Error(message + ". Make sure your component is available to render.")
323323
} else {
324-
let component = this.components[cacheId];
324+
var component = this.components[cacheId];
325325
if(component === undefined) {
326326
component = React.createElement(constructor, props);
327327
if(turbolinksPermanent) {
@@ -440,12 +440,12 @@ module.exports = {
440440
// Turbolinks 5+ got rid of named events (?!)
441441
setup: function(ujs) {
442442
ujs.handleEvent('turbolinks:load', ujs.handleMount);
443-
ujs.handleEvent('turbolinks:before-render', ujs.handleMount);
443+
ujs.handleEvent('turbolinks:before-render', ujs.handleUnmount);
444444
},
445445

446446
teardown: function(ujs) {
447447
ujs.removeEvent('turbolinks:load', ujs.handleMount);
448-
ujs.removeEvent('turbolinks:before-render', ujs.handleMount);
448+
ujs.removeEvent('turbolinks:before-render', ujs.handleUnmount);
449449
},
450450
}
451451

react_ujs/dist/react_ujs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ var ReactRailsUJS = {
321321
}
322322
throw new Error(message + ". Make sure your component is available to render.")
323323
} else {
324-
let component = this.components[cacheId];
324+
var component = this.components[cacheId];
325325
if(component === undefined) {
326326
component = React.createElement(constructor, props);
327327
if(turbolinksPermanent) {
@@ -440,12 +440,12 @@ module.exports = {
440440
// Turbolinks 5+ got rid of named events (?!)
441441
setup: function(ujs) {
442442
ujs.handleEvent('turbolinks:load', ujs.handleMount);
443-
ujs.handleEvent('turbolinks:before-render', ujs.handleMount);
443+
ujs.handleEvent('turbolinks:before-render', ujs.handleUnmount);
444444
},
445445

446446
teardown: function(ujs) {
447447
ujs.removeEvent('turbolinks:load', ujs.handleMount);
448-
ujs.removeEvent('turbolinks:before-render', ujs.handleMount);
448+
ujs.removeEvent('turbolinks:before-render', ujs.handleUnmount);
449449
},
450450
}
451451

0 commit comments

Comments
 (0)