Skip to content

[Agile-224] lazy load backlog work package cards#23962

Draft
ulferts wants to merge 8 commits into
devfrom
code-maintenance/agile-224-overhaul-reloading-patterns-on-backlog-and-sprints-page-turbo-frame-caching
Draft

[Agile-224] lazy load backlog work package cards#23962
ulferts wants to merge 8 commits into
devfrom
code-maintenance/agile-224-overhaul-reloading-patterns-on-backlog-and-sprints-page-turbo-frame-caching

Conversation

@ulferts

@ulferts ulferts commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Ticket

https://community.openproject.org/wp/AGILE-224

What are you trying to accomplish?

Load the work package cards displayed on the backlogs and sprints page lazily and individually via turbo-frames. But also cache them in the frontend so that the hit on loading the cards one by one is in fact only happening initially. The cache is a checksum calculated in the database that includes all the records displayed on the card. The checksum becomes part of the turbo-frame's src. Changes to the checksum in the src represent changes to the work package card busting the cache. When the page needs to be reloaded, e.g. after moving a work package or after changing it in the split screen, only the structure of the page is actually reloaded. When reloading the page, a small JS prevents reshowing the skeletons. Almost all of the work package cards will not need to be reloaded, as signaled by their checksum. Only the dragged or updated work package will actually be loaded from the server.

This PR works nicely together with #23885 which removed the page's state (e.g. all=true) from the card, especially in the menu.

The pattern is extracted from #23308 which includes even more description.

TODO

  • port the spike over into production code
  • fix having an outdated menu in case the menu has been opened before. That was a side effect of the card's dom being unchanged. Now the card is always loaded from cache if it is unchanged.
  • Extract the frame behaviour into a dedicated controller for reusability.
  • Evaluate if only loading required columns (id and hash) for the work package improves performance - no significant gains observed.
  • Check and possibly adjust height of skeletons for frames
  • WorkPackage.visible is executed twice both when fetching the work packages for the sprints as well as for the backlogs. Ideally, the performance of these sql requests is improved.

Out of scope

  • moving the stimulus controller from the li element inside the newly added turbo-frame. This would reduce the number of controllers initialized at load time.
  • Loading of the content-body's turbo-frame. The page is still loaded first mostly empty only to then have the turbo frame load the actual backlogs and sprints information.

Merge checklist

  • Added/updated tests

@ulferts ulferts force-pushed the code-maintenance/agile-224-overhaul-reloading-patterns-on-backlog-and-sprints-page-turbo-frame-caching branch from 00ab736 to 7ba0d7f Compare June 26, 2026 11:30
Comment thread modules/backlogs/app/models/work_packages/scopes/with_card_hash.rb Fixed
ulferts added 4 commits June 26, 2026 16:31
The skeleton is still not shown but issuing .reload() on the frame replaces any frontend added dom like the menu with the already cached version of the card. This prevents the menu being stale.
@ulferts ulferts force-pushed the code-maintenance/agile-224-overhaul-reloading-patterns-on-backlog-and-sprints-page-turbo-frame-caching branch from 6a5a227 to 03ceb70 Compare June 26, 2026 14:33
instance_version = connection.quote(OpenProject::VERSION.to_s)

left_outer_joins(:status, :assigned_to, :type, :priority)
.joins("LEFT JOIN (#{visible_parent(user)}) card_hash_parents ON card_hash_parents.id = work_packages.parent_id")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user is passed into WorkPackages.visible only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants