Skip to content

Components aren't mounted on turbolinks cache #960

Closed
@joshleblanc

Description

@joshleblanc

Help us help you! Have you looked for similar issues? Do you have reproduction steps? Contributing Guide

Steps to reproduce

Place a component on your page. Navigation to that page, then to another, then back to the page with the component.

In the period between turbolinks showing you the cached page, and fetching the new one, no components are mounted.

Expected behavior

The cached page should at least show the component. If remounting it temporarily has too many side effect. I know stimulus just mounts and unmounts it as the cache is replaced.

Actual behavior

The components don't show up at all. There's just empty space.

System configuration

Sprockets or Webpacker version: 3.5
React-Rails version: 2.4
Rect_UJS version: 2.4.4
Rails version: 5.2.2
Ruby version: 2.4.5


I'm not actually sure if I should be posting this here or over at turbolinks, but seeing as not even data-turbolinks-permanent, I feel like it must be something react-rails is doing.

If you render a component, navigate away, and navigate back, the component is gone until turbolinks finishes loading. Even if the component has a data-turbolinks-permanent tag, or if its parent has it. The component just doesn't exist.

So if I have a slow page load, I end up with many seconds of elements just... not there. It's not very pretty.

Here's a gif of what I mean. After navigation back to the first page, the table doesn't mount.

1oumczyorq

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions