Skip to content

Commit

Permalink
Change Turbolinks unmount event from before-visit to before-render (#709
Browse files Browse the repository at this point in the history
)

* change turbolinks unmount event from before-visit to before-render
* Addresses #706
  • Loading branch information
szyablitsky authored and justin808 committed Feb 11, 2017
1 parent 4badd57 commit 7ad5c13
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]

## [Unreleased]
*Please add entries here for your pull requests.*
### Fixed
- Fixed issue [#706](https://github.com/shakacode/react_on_rails/issues/706) with "flickering" components when they are unmounted too early [#709](https://github.com/shakacode/react_on_rails/pull/709) by [szyablitsky](https://github.com/szyablitsky)

## [6.5.0] - 2017-01-31
### Added
Expand Down
2 changes: 1 addition & 1 deletion docs/additional-reading/turbolinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ TURBO: reactOnRailsPageLoaded

Turbolinks 5:
```
TURBO: WITH TURBOLINKS 5: document turbolinks:before-cache and turbolinks:load handlers installed. (program)
TURBO: WITH TURBOLINKS 5: document turbolinks:before-render and turbolinks:load handlers installed. (program)
TURBO: reactOnRailsPageLoaded
```

Expand Down
2 changes: 1 addition & 1 deletion docs/api/javascript-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The best source of docs is the main [ReactOnRails.js](../../node_package/src/Rea
* Main entry point to using the react-on-rails npm package. This is how Rails will be able to
* find you components for rendering. Components get called with props, or you may use a
* "generator function" to return a React component or an object with the following shape:
* { renderedHtml, redirectLocation, error }.
* { renderedHtml, redirectLocation, error }.
* @param components (key is component name, value is component)
*/
register(components)
Expand Down
4 changes: 2 additions & 2 deletions node_package/src/clientStartup.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export function clientStartup(context) {
if (turbolinksVersion5()) {
debugTurbolinks(
'USING TURBOLINKS 5: document added event listeners ' +
' turbolinks:before-visit and turbolinks:load.');
document.addEventListener('turbolinks:before-visit', reactOnRailsPageUnloaded);
'turbolinks:before-render and turbolinks:load.');
document.addEventListener('turbolinks:before-render', reactOnRailsPageUnloaded);
document.addEventListener('turbolinks:load', reactOnRailsPageLoaded);
} else {
debugTurbolinks(
Expand Down

0 comments on commit 7ad5c13

Please sign in to comment.