You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Basic Features > Navigate to another page > How'd You Get Here?, are the last two examples duplicates? They both seem to be showing the same thing (refreshing programmatically with replace):
The text was updated successfully, but these errors were encountered:
The outcome of both actions is identical, but the methods used to trigger the page refresh differ:
The "Refresh" button performs a replace visit by linking to the same page with data-turbo-action="replace", which triggers a Turbo morph.
The "Refresh programmatically" button calls the JavaScript function Turbo.session.refresh(document.baseURI), which also triggers a Turbo morph.
<pclass="space --bottom-s">This performs a <code>replace</code> visit to the current page, refreshing its content with morphing:</p><p><ahref="/one" class="button@native" data-turbo-action="replace">Refresh</a></p><pclass="space --bottom-s">This programatically refreshes the current page, performing a <code>replace</code> visit and refreshing its content with morphing:</p><p><aid="refresh" class="button@native" data-turbo-action="replace">Refresh programatically</a></p><footerclass="text --size-s --color-subtle space --top-xxl">
Rendered <%- new Date().toLocaleString() %> via Turbo 8
</footer><script>document.getElementById("refresh").addEventListener("click",()=>{Turbo.session.refresh(document.baseURI)})</script>
I guess the demo just wanna illustrates that both approaches can refresh the page content through morphing, but one uses an HTML anchor link, while the other relies on JavaScript to achieve the same result.
I've followed the instructions in the Hotwire Native iOS: Getting Started guide, and am playing around with the demo app.
In
Basic Features > Navigate to another page > How'd You Get Here?
, are the last two examples duplicates? They both seem to be showing the same thing (refreshing programmatically withreplace
):The text was updated successfully, but these errors were encountered: