I am having the odd situation that live_patch seems to render full page loads.
In my .leex file:
<%= live_patch "Test", to: Routes.test_path(@socket, :index) %>
Expected behavior: handle_params/3 is invoked.
Observed behavior: mount/3 and then handle_params/3 is invoked.
My app.js:
import 'phoenix_html'
import { Socket } from "phoenix"
import LiveSocket from "phoenix_live_view"
// if we do have a crsf token (all pages except error pages)
// then connect live socket and enable various functionalities
const csrf_elm = document.querySelector("meta[name='csrf-token']")
if(csrf_elm){
const _csrf_token = csrf_elm.getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, { params: { _csrf_token } })
liveSocket.connect()
}
My router.ex:
...
live "/", TestLive, :index
...
Any ideas what could be causing full page reloads?
Looking into the developer tools, the patch link seems to be created correctly:
<a data-phx-link="patch" data-phx-link-state="push" href="/">Test</a>