Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

live_redirect does not remember scroll position if a live_patch is done before it #2080

Closed
dvic opened this issue Jun 24, 2022 · 4 comments · Fixed by #2173
Closed

live_redirect does not remember scroll position if a live_patch is done before it #2080

dvic opened this issue Jun 24, 2022 · 4 comments · Fixed by #2173

Comments

@dvic
Copy link
Contributor

dvic commented Jun 24, 2022

Environment

  • Elixir version (elixir -v): 1.13.4
  • Phoenix version (mix deps): 1.6.10
  • Phoenix LiveView version (mix deps): 0.17.10
  • Browsers you attempted to reproduce this bug on (the more the merrier): chrome, firefox, safari
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes: yes

Actual behavior

setup: liveview A and liveview B

SITUATION 1

  1. load liveview A and scroll down
  2. cilck on a live_redirect to liveview B
  3. browser back returns to original scroll position of liveview A

SITUATION 2 (same as SITUATION 1 but with a live_patch in between)

  1. load liveview A and scroll down
  2. do live_patch, scroll more down
  3. cilck on a live_redirect to liveview B
  4. browser back does not return to original scroll position of liveview A

Expected behavior

I did not expect that a live_patch before a live_redirect would change the way the back button works w.r.t. the scroll position.

Is this intended behavior or a possible bug?

Actual usecase:

List view of items with a "load more button" (which is the live_patch), I'd like to be able to click on one item (liveview B) and go back to the original position in the list.

@dvic
Copy link
Contributor Author

dvic commented Jun 24, 2022

If it helps, I can make a repo that reproduces this.

@dvic
Copy link
Contributor Author

dvic commented Jun 29, 2022

Here is the repo that reproduces this: https://github.com/qdentity/lv_reproduction_repo/tree/scroll-bug

and here is a video that shows that the scroll position is lost after "load more" is clicked (which is a live_patch):

scroll_bug.mov

@dvic
Copy link
Contributor Author

dvic commented Jul 8, 2022

Just checked if #2097 fixed this issue: it does not 🙁

@dvic
Copy link
Contributor Author

dvic commented Sep 6, 2022

Update: #2173 fixes this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant