Skip to content

Commit 0bbbb14

Browse files
author
William Meleyal
committed
disable the Turbolinks cache, fixes #87
1 parent b308749 commit 0bbbb14

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Component = React.createClass
8484

8585
To use `react_ujs`, simply `require` it after `react` (and after `turbolinks` if [Turbolinks](https://github.com/rails/turbolinks) is used):
8686

87+
**Note:** _`react_ujs` disables the Turbolinks cache. This is a workaround to ensure components are correctly unmounted. See [#87](https://github.com/reactjs/react-rails/issues/87) for details._
88+
8789
```js
8890
// app/assets/javascripts/application.js
8991

lib/assets/javascripts/react_ujs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838

3939
var handleTurbolinksEvents = function() {
4040
var handleEvent;
41+
42+
// Disable the Turbolinks cache.
43+
Turbolinks.pagesCached(0);
44+
4145
if ($) {
4246
handleEvent = function(eventName, callback) {
4347
$(document).on(eventName, callback);

0 commit comments

Comments
 (0)