Phoenix_live_view: Back button does not update the page view after live_redirect

Created on 2 Nov 2019  路  4Comments  路  Source: phoenixframework/phoenix_live_view

Environment

  • Elixir 1.9.2 (compiled with Erlang/OTP 22)
  • phoenix 1.4.10 (Hex package) (mix)
  • phoenix_live_view 0.3.0 (https://github.com/phoenixframework/phoenix_live_view.git) (mix)
    locked at b884a9e (master from 2019-11-01)
  • node - v10.11.0
  • npm - v6.4.1
  • MacOS Mojave 10.14.6

Actual behavior

I'm not sure if anyone sees comments on closed issues, so I'm opening a new one.

The commit to fix #380 does not work for me on Chrome v78, Firefox v70, and Safari v13.

I cloned @jfreeze repo https://github.com/jfreeze/ForBak then bumped phoenix_live_view dep to master. Then followed the same instructions in the original issue. Going to /registrations/new then clicking the button which live_redirects to the show page. After that clicking the back button causes the URL to change but not the view. If you then click forward then back again it updates properly.

Expected behavior

Clicking the back button from a page you were live_redirected to should update both the URL and the browser's view.

Most helpful comment

Fixed. Thanks!

All 4 comments

@tmepple I looked into this and master currently has the correct behaviour. There may have been fixes in the meantime. My only guess is perhaps your deps got out of sync?

{:phoenix_live_view, github: "phoenixframework/phoenix_live_view"},

Hi @snewcomer, thanks for the fast response.

Yeah I set my mix.exs to pull master from github like your snippet does. I even checked my compiled app.js in the /priv directory to make sure webpack was bundling the master version with live_component and it was.

If you clone @jfreeze repo and follow the exact same steps as me pulling from master you are getting correct behaviour??? If so I have no idea what I am doing wrong.

I think I know what the problem is. This commit from Sept 23rd fixing the original issue no longer appears in master: https://github.com/phoenixframework/phoenix_live_view/commit/ffe65f9abe9f29151ea15d75f7e409f332ebff7b

When I manually patch that change back in and rebuild the priv JS everything works great.

I looked at the commit history and couldn't find a later commit that reverts this so not sure why it's not in the latest master.

Fixed. Thanks!

Was this page helpful?
0 / 5 - 0 ratings