Temporary transactions page performance fix #2372
Reference in New Issue
Block a user
Delete Branch "zachgoll/transactions-page-temporary-perf-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?
This PR is a temporary solution to speed up the transactions page. A longer-term fix will fully replace this very hacky solution, but will require a larger rework of the search query.
Before:
After:
Bug: Transaction Cache Invalidation and Key Issues
The transaction index page's caching mechanism has several flaws:
maximum(:updated_at)of existing entries. This can result in stale cached IDs, leading to fewer transactions displayed.request.query_parameters.to_h, which may not match the processedsearch_paramsused for the actual query (e.g., due to default date ranges), causing cache misses or incorrect results.focused_record_idin the cache key (which Pagy explicitly excludes from its parameters) causes unnecessary cache fragmentation, reducing hit rates and increasing memory usage.app/controllers/transactions_controller.rb#L25-L40f876176626/app/controllers/transactions_controller.rb (L25-L40)Fix in Cursor
Was this report helpful? Give feedback by reacting with 👍 or 👎
Bug: Caching Failures and Type Errors in Pagination
The new caching and pagination logic in
TransactionsController#indexintroduces several issues:items_per_page(a string from request parameters) is passed directly toActiveRecord::QueryMethods#limit, which expects an integer, potentially causing a runtime error. Similarly,current_pageanditems_per_pageare passed as strings to thePagy.newconstructor, which expects integers, potentially leading to type errors or incorrect pagination behavior.app/controllers/transactions_controller.rb#L64-L85a087168b66/app/controllers/transactions_controller.rb (L64-L85)Fix in Cursor
Was this report helpful? Give feedback by reacting with 👍 or 👎
✅ BugBot reviewed your changes and found no bugs!
Was this report helpful? Give feedback by reacting with 👍 or 👎