rubyruby-on-rails-3turboturbo-ios

Why is the page title not not changing in a turbo-ios app


In a Ruby on Rails app, I am setting the title by the following code in the head tag

<title><%= @title %></title>

where @title is set in the controller action for each page. Running as a web-app, this works fine. But if I run it as a turbo-ios app, when I navigate from page to page, the title does not change from the title of the starting page. I have made no modifications to the standard turbo-ios SceneDelegate class, apart from setting a custom user agent.

According to the turbo-ios documentation

"By default, Turbo iOS sets your Visitable view controller’s title property to the page’s title."

So why is this happening and how do I fix this?

I have also taken the turbo-ios demo app and altered the definitions of basic and turbolinks5 in Demo.swift to point to my app, and I can navigate between pages but the title does not change.

Update

I have found that if I remove this tag from the <head>

<%= turbo_include_tags %>

it fixes the problem and also presents the < navigation link (back) in the top section of app. So it looks like the problem is with Turbo Drive. I need to use Turbo Drive, so is there a work around?


Solution

  • As per @Maniac's comment above, the Turbo documentation states that "Turbo Drive avoids updating the Turbo iOS view controller's title property by default to avoid unnecessary re-rendering and navigation gestures."

    However, when I implemented a native top menu using strada-ios the title changes correctly without adding any code to do this.