Skip to content

Commit be7a134

Browse files
committed
Fixes #743
1 parent 8c1be8f commit be7a134

File tree

6 files changed

+25
-21
lines changed

6 files changed

+25
-21
lines changed

lib/assets/javascripts/react_ujs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var turbolinksClassicEvents = __webpack_require__(10)
119119
module.exports = function(ujs) {
120120
if (ujs.handleEvent) {
121121
// We're calling this a second time -- remove previous handlers
122-
if (typeof Turbolinks.EVENTS !== "undefined") {
122+
if (typeof Turbolinks !== "undefined" && typeof Turbolinks.EVENTS !== "undefined") {
123123
turbolinksClassicEvents.teardown(ujs);
124124
}
125125
turbolinksEvents.teardown(ujs);

react_ujs/dist/react_ujs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var turbolinksClassicEvents = __webpack_require__(10)
119119
module.exports = function(ujs) {
120120
if (ujs.handleEvent) {
121121
// We're calling this a second time -- remove previous handlers
122-
if (typeof Turbolinks.EVENTS !== "undefined") {
122+
if (typeof Turbolinks !== "undefined" && typeof Turbolinks.EVENTS !== "undefined") {
123123
turbolinksClassicEvents.teardown(ujs);
124124
}
125125
turbolinksEvents.teardown(ujs);

react_ujs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react_ujs",
3-
"version": "2.2.1",
3+
"version": "2.3.1",
44
"description": "Rails UJS for the react-rails gem",
55
"main": "index.js",
66
"repository": "reactjs/react-rails",

react_ujs/src/events/detect.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var turbolinksClassicEvents = require("./turbolinksClassic")
99
module.exports = function(ujs) {
1010
if (ujs.handleEvent) {
1111
// We're calling this a second time -- remove previous handlers
12-
if (typeof Turbolinks.EVENTS !== "undefined") {
12+
if (typeof Turbolinks !== "undefined" && typeof Turbolinks.EVENTS !== "undefined") {
1313
turbolinksClassicEvents.teardown(ujs);
1414
}
1515
turbolinksEvents.teardown(ujs);

react_ujs/yarn.lock

+20-16
Original file line numberDiff line numberDiff line change
@@ -468,14 +468,14 @@ emojis-list@^2.0.0:
468468
version "2.1.0"
469469
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
470470

471-
enhanced-resolve@^3.0.0:
472-
version "3.1.0"
473-
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.1.0.tgz#9f4b626f577245edcf4b2ad83d86e17f4f421dec"
471+
enhanced-resolve@^3.3.0:
472+
version "3.4.1"
473+
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e"
474474
dependencies:
475475
graceful-fs "^4.1.2"
476476
memory-fs "^0.4.0"
477477
object-assign "^4.0.1"
478-
tapable "^0.2.5"
478+
tapable "^0.2.7"
479479

480480
errno@^0.1.3:
481481
version "0.1.4"
@@ -1428,9 +1428,9 @@ [email protected]:
14281428
dependencies:
14291429
hoek "2.x.x"
14301430

1431-
source-list-map@^1.1.1:
1432-
version "1.1.2"
1433-
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.2.tgz#9889019d1024cce55cdc069498337ef6186a11a1"
1431+
source-list-map@^2.0.0:
1432+
version "2.0.0"
1433+
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
14341434

14351435
source-map@^0.5.3, source-map@~0.5.1, source-map@~0.5.3:
14361436
version "0.5.6"
@@ -1525,7 +1525,11 @@ supports-color@^3.1.0:
15251525
dependencies:
15261526
has-flag "^1.0.0"
15271527

1528-
tapable@^0.2.5, tapable@~0.2.5:
1528+
tapable@^0.2.7:
1529+
version "0.2.8"
1530+
resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22"
1531+
1532+
tapable@~0.2.5:
15291533
version "0.2.6"
15301534
resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.6.tgz#206be8e188860b514425375e6f1ae89bfb01fd8d"
15311535

@@ -1645,23 +1649,23 @@ watchpack@^1.3.1:
16451649
chokidar "^1.4.3"
16461650
graceful-fs "^4.1.2"
16471651

1648-
webpack-sources@^0.2.3:
1649-
version "0.2.3"
1650-
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.2.3.tgz#17c62bfaf13c707f9d02c479e0dcdde8380697fb"
1652+
webpack-sources@^1.0.1:
1653+
version "1.0.1"
1654+
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
16511655
dependencies:
1652-
source-list-map "^1.1.1"
1656+
source-list-map "^2.0.0"
16531657
source-map "~0.5.3"
16541658

16551659
webpack@^2.3.3:
1656-
version "2.6.1"
1657-
resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.6.1.tgz#2e0457f0abb1ac5df3ab106c69c672f236785f07"
1660+
version "2.7.0"
1661+
resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.7.0.tgz#b2a1226804373ffd3d03ea9c6bd525067034f6b1"
16581662
dependencies:
16591663
acorn "^5.0.0"
16601664
acorn-dynamic-import "^2.0.0"
16611665
ajv "^4.7.0"
16621666
ajv-keywords "^1.1.1"
16631667
async "^2.1.2"
1664-
enhanced-resolve "^3.0.0"
1668+
enhanced-resolve "^3.3.0"
16651669
interpret "^1.0.0"
16661670
json-loader "^0.5.4"
16671671
json5 "^0.5.1"
@@ -1675,7 +1679,7 @@ webpack@^2.3.3:
16751679
tapable "~0.2.5"
16761680
uglify-js "^2.8.27"
16771681
watchpack "^1.3.1"
1678-
webpack-sources "^0.2.3"
1682+
webpack-sources "^1.0.1"
16791683
yargs "^6.0.0"
16801684

16811685
which-module@^1.0.0:

test/react/rails/react_rails_ujs_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def refute_greeting(page, greeting)
103103

104104
test 'react_ujs works without Turbolinks' do # Fixes #743
105105
visit '/no-turbolinks'
106-
assert page.execute_script('ReactRailsUJS.detectEvents()')
106+
assert_nil page.execute_script('ReactRailsUJS.detectEvents()')
107107
end
108108

109109
test 'react_ujs can unmount/mount using a selector reference for a component parent' do

0 commit comments

Comments
 (0)