Skip to content

Content flashes on page revisit even with Turbolinks enabled #135

@bbugh

Description

@bbugh

Hi! 👋 Very cool gem.

It's quite possible that I'm misunderstanding the intent, so this may not be a bug. Whenever I re-visit a Turbolinks page that has a render_async on it, the render_async runs again (which is great) resulting in an empty space or placeholder loading content (which is not ideal).

The hope was for this particular sometimes slow-loading page that we could

  1. draw a loading spinner until the content is returned
  2. Turbolinks caches the page
  3. Upon cache restore:
    1. the content is restored as it was from the Turbolinks cache
    2. render_async calls the server
    3. if content is different, it's replaced, but otherwise users don't see this

This happens with render_async and render_async_cache.

I made sure to follow the documentation closely, (set the turbolinks option in an initializer, the content_for is in the <head>) but I can't seem to make this work with a fresh Rails 6.0.3.3. or 6.1rc1 app. Am I misunderstanding what should happen here or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions