From f242648e9110fa9e848bad423ef3c51a63816e50 Mon Sep 17 00:00:00 2001 From: Phil Monroe Date: Wed, 5 Apr 2017 16:48:44 -0700 Subject: [PATCH] Proper caching and mounting with Turbolinks 5 --- javascript/webpacker_react-npm-module/src/index.js | 2 +- javascript/webpacker_react-npm-module/src/ujs.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/javascript/webpacker_react-npm-module/src/index.js b/javascript/webpacker_react-npm-module/src/index.js index c164a7f..4314a41 100644 --- a/javascript/webpacker_react-npm-module/src/index.js +++ b/javascript/webpacker_react-npm-module/src/index.js @@ -69,7 +69,7 @@ const WebpackerReact = { const component = registeredComponents[className] if (component) { - if (node.innerHTML.length === 0) this.render(node, component) + this.render(node, component) } else { console.error(`webpacker-react: cant render a component that has not been registered: ${className}`) } diff --git a/javascript/webpacker_react-npm-module/src/ujs.js b/javascript/webpacker_react-npm-module/src/ujs.js index 63b78a0..60006e9 100644 --- a/javascript/webpacker_react-npm-module/src/ujs.js +++ b/javascript/webpacker_react-npm-module/src/ujs.js @@ -40,8 +40,7 @@ const ujs = { }, turbolinks5(onMount, onUnmount) { - this.handleEvent('turbolinks:load', onMount, { once: true }) - this.handleEvent('turbolinks:render', onMount) + this.handleEvent('turbolinks:load', onMount) this.handleEvent('turbolinks:before-render', onUnmount) },