One of the big issues that we face is that when we are viewing a long list of items, click an item to go to the item detail screen, and then click back, we’re taking to the top of the screen and the page refreshes.
This really sucks when you’re scrolling like a social media feed and you click the comments and go back only to be back at the very beginning of the feed!
Here’s what I’ve done to accomplish a ‘back handler’ to retain the position in the viewport of the list screen:
On your list screen: Add an input called “Back post viewer” and an input called “post reloader”. For the “back post viewer” input, set a default value of the maximum ID number of the list. On the “post reloader” input, set a default value of 0.
I have the list sorted by ID #, high to low. There is a filter where post id is less than or equal to back post viewer:
Also add a button added that says load previous posts. Set the visibility of the button to only visible when post reloader is equal to 1.
Add 2 actions to this button. Change input value of “back post viewer” input to maximum post id and change input value of post reloader input to 0.
When someone clicks the image or comments, they’re taken to a new screen that displays either the image or the comments for the post.
Now, when we click back to go back to the list, we add 2 actions before the link back. Change input value of Back post viewer to the current post > post id and change the input value of the “post reloader” input to 1.
So when a user goes back to the list, they will be taken to the top of the screen but the post they were viewing is now the top post on the list and they can resume scrolling down the list from the spot they were at previously.