At the end of the day, regardless if you invoke link/2
, live_patch/2
,
and live_redirect/2
from the client, or redirect/2
, push_patch/2
,
and push_redirect/2
from the server, the user will end-up on the same
page. The difference between those is mostly the amount of data sent over
the wire:
-
link/2
andredirect/2
do full page reloads -
live_redirect/2
andpush_redirect/2
reloads the LiveView but
keeps the current layout -
live_patch/2
andpush_patch/2
updates the current LiveView and
sends only the minimal diff
An easy rule of thumb is to stick with live_redirect/2
and push_redirect/2
and use the patch helpers only in the cases where you want to minimize the
amount of data sent when navigating within the same LiveView (for example,
if you want to change the sorting of a table while also updating the URL).