Carlos Martinez
This spec is completed
With turbolinks active in the app, pages are being cached. This means that when the user navigates back to the page, turbolinks will display the cached version of the page, after that, the react components will be mounted and rendered.
If the timer was started, this will generate a problem trying to render the state of it. It looks as follows:
(I'm navigating through the turbolinks [ha])
What happens is:
- Turbolinks loads the page from the cache (that's why it displays the last value)
- Mounts the components (goes to 0 -see related issue- and then renders the current state)
A possible solution to this problem would be simply to disable cache for the timer page, this will avoid also the problem with the select input value:
Company layout:
<!DOCTYPE html>
<html>
<head>
<title>Denbora</title>
<%= yield :head_metadata %>
...
</head>
<body>
...
</body>
</html>
Time entries index.html:
<% content_for :head_metadata do %>
<meta name="turbolinks-cache-control" content="no-cache">
<% end %>
Turbolinks is always issuing a network request and rerendering the list of entries and timer when the page loads anyway, so we're not losing much disabling the cache for this page.
related documentation on application visits within turbolinks
LGTM