Hotwire native - disable back caching or bust cache

I’m working on a Hotwire Native iOS app. I have a page that links to a second page. On the second page, I can perform actions that would affect the contents of the first page. The problem is that when I do that, the “back” action in the top right takes me back to a stale/cached copy of the first page. Is there a way to force a page reload when I’ve changed the contents of the first page, or some other way to handle this better? Thanks!

Your backend controller should respond to the POST requests with a redirect to /refresh_historical_location.

class FooController
  def create
    refresh_or_redirect_to some_path, status: :see_other
  end
end

This should bust the cache and pressing the back button should cause the webview to reload.

Let me know if it works!

If the second page submits a form at all the cache will bust. Any standard HTTP POST will trigger it.

Hmm, it was submitting a form though (albeit via js), that’s strange. Well, luckily it happens that we reworked it into one page so the issue doesn’t appear.

Yeah, the framework won’t know about any requests made via JavaScript, It has to come from a boring ol’ HTML <form> that does a non-GET request.

Hmm. To be clear, I’m calling form.requestSubmit on a regular form. So it’s not making the request via js, just triggering the submit that way. But idk, it’s not a problem for me anymore.