React-rails: Permanent Turbolinks components without a specified cache ID will be loaded for all components without a cache ID

Created on 20 Sep 2019  路  1Comment  路  Source: reactjs/react-rails

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

Hacktoberfest bug

Most helpful comment

I can take a stab at it.

>All comments

I can take a stab at it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  4Comments

dylanitorium picture dylanitorium  路  4Comments

okolomoets picture okolomoets  路  5Comments

prasanthrubyist picture prasanthrubyist  路  3Comments

adoseofjess picture adoseofjess  路  4Comments