Preserve pagination on entry updates #1563
Reference in New Issue
Block a user
Delete Branch "zachgoll/pagination-refresh-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #1562
This is far from a perfect solution to a tricky problem.
On the account page, we are rendering the "Activity View" inside a turbo frame. Within that Turbo frame, we have the pagination controls. By default, clicking a new page will update the query param within the frame by default, which means that when the Transaction drawer is closed (and the page auto-refreshes to reload the list), the page that was changed within the turbo frame is not preserved because the top-level page is not aware of it.
There are two potential solutions I can think of, which I've chosen the 1st for simplicity:
params[:page]down into the Turbo frame and use a custom URL pagination helper for pagination controls that is aware of the top-level page we're currently on.a. Since editing a transaction/trade/balance affects the entire Account history, we're simply refreshing the page entirely rather than attempting to apply Turbo stream updates to the affected parts (most of the page)
b. If we removed this behavior, the user would not see their most recent edits in the activity list, which I think is less ideal than this page refresh
Keeping the entry lists / pagination params synced while editing in the drawer is something we'll have to address with more precision at a later date, but think this is a decent tradeoff for now to keep things as simple as possible.