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

Preserve pagination on entry updates #1563

Merged
merged 2 commits into from
Dec 20, 2024
Merged

Conversation

zachgoll
Copy link
Collaborator

@zachgoll zachgoll commented Dec 20, 2024

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:

  1. Pass the 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.
  2. Stop refreshing the page when editing drawers are closed
    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.

@zachgoll zachgoll merged commit a4d1009 into main Dec 20, 2024
5 checks passed
@zachgoll zachgoll deleted the zachgoll/pagination-refresh-fix branch December 20, 2024 16:24
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 this pull request may close these issues.

Bug: modifying a transaction reloads the page without retaining pagination
1 participant