react-rails
react-rails copied to clipboard
Permanent Turbolinks components without a specified cache ID will be loaded for all components without a cache ID
Help us help you! Have you looked for similar issues? Do you have reproduction steps? Contributing Guide
Steps to reproduce
<%= react_component "MyComponent", {prop_a: 1}, {data: {"turbolinks-permanent": true}} %> <!-- Renders correctly -->
<%= react_component "MyOtherComponent", {prop_b: 2} %> <!-- Renders "MyComponent" with "prop_a" instead of "MyOtherComponent" with "prop_b" -->
(Guidelines for creating a bug report are available here)
Expected behavior
Tell us what should happen
The later call to render MyOtherComponent
should render MyOtherComponent
and not MyComponent
.
Actual behavior
Tell us what happens instead
Because the react-cache-id
data attribute is not specified but turbolinks-permanent
is set to true
the component is cached under the key undefined
. So any other components that are rendered after that component which also has react-cache-id
undefined
will instead use the incorrectly cached component, regardless of turbolinks-permanent
being defined or not
System configuration
Sprockets or Webpacker version: Sprockets 3.7.2, Webpacker 4.0.7 React-Rails version: 2.6.0 Rect_UJS version: Unknown Rails version: 5.2.3 Ruby version:2.3.8p459
I can take a stab at it.
@ivnflpz @joeyparis, Any updates on this issue? Closing it for now. Feel free to reopen it.