-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Bug/66552: Large amount of comments causes work package view to freeze (introduce lazy-loading and loading indicator for Activity tab) #20365
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
Conversation
0f4bfe7
to
65ed336
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements lazy loading with infinite scrolling for the Activity tab to address performance issues when work packages have large amounts of comments. The change replaces the previous deferred rendering mechanism with a paginated approach using the Pagy gem.
Key changes include:
- Introduction of infinite scroll functionality triggered by intersection observer
- Implementation of Pagy-based pagination with 30 items per page
- Addition of scroll position preservation during DOM manipulations
- New skeleton loading indicator for better user experience
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
frontend/src/stimulus/setup.ts | Registers new infinite scroll Stimulus controller |
frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/services/dom_helpers.ts | Provides scroll preservation utilities for infinite scroll |
frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/infinite-scroll.controller.ts | Main infinite scroll controller implementation |
config/routes.rb | Adds page_streams route for pagination |
config/initializers/permissions.rb | Grants page_streams permission |
config/initializers/pagy.rb | Pagy pagination library configuration |
app/controllers/work_packages/activities_tab_controller.rb | Implements pagination logic and page streaming |
app/controllers/concerns/op_turbo/component_stream.rb | Adds turbo stream helpers for pagination |
app/components/work_packages/activities_tab/shared_helpers.rb | Adds sorting helper methods |
app/components/work_packages/activities_tab/journals/page_component.rb | Component for rendering journal pages |
app/components/work_packages/activities_tab/journals/infinite_scroll_component.rb | Infinite scroll trigger component |
app/components/work_packages/activities_tab/journals/index_component.rb | Refactored to support pagination |
app/components/work_packages/activities_tab/index_component.rb | Updated to pass pagination data |
app/components/concerns/work_packages/activities_tab/stimulus_controllers.rb | Adds infinite scroll controller reference |
Gemfile | Adds Pagy gem dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.../src/stimulus/controllers/dynamic/work-packages/activities-tab/infinite-scroll.controller.ts
Outdated
Show resolved
Hide resolved
app/components/work_packages/activities_tab/journals/infinite_scroll_component.rb
Outdated
Show resolved
Hide resolved
frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/services/dom_helpers.ts
Outdated
Show resolved
Hide resolved
app/components/concerns/work_packages/activities_tab/stimulus_controllers.rb
Outdated
Show resolved
Hide resolved
4d04f29
to
35e67c4
Compare
Pick up any changes to sorting or filtering preferences
Add `wait_for_network_idle` at the start of `type_comment` to ensure all pending Turbo Stream rendering completes before attempting to interact with the form. This is needed as the lazy pages now intercept turbo stream rendering.
eb104e6
to
de6c207
Compare
de6c207
to
7940486
Compare
Caution The provided work package version does not match the core version Details:
Please make sure that:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, nice work! As far as I can tell this works amazingly! 🎉
I have some small comments / questions, but nothing blocking 🙂
frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/services/url-helpers.ts
Show resolved
Hide resolved
7068e6d
to
12a5f55
Compare
👋🏾 @myabc @dombesz - will merge now to get things moving (Thanks for the review @judithroth ! 💪🏾 ). Please still feel free to share any feedback you have- as I spoke to you both on the topic :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement @akabiru ! Bit late to the party, but I just leave a few comments. None of them are critical.
Ticket
https://community.openproject.org/wp/66552
What are you trying to accomplish?
Add lazy loaded pages to the activity tab. Remove the deferred render-all pages mechanism.
🌮 Todos (WIP 🚧 )
Overlay filter & sorting components so that they are always visible (On Desktop)Important
The last two items, filtering & DB query optimisation will be handled separately.
Screenshots
deep-linking-works.mp4
What approach did you choose and why?
Eager load only one page (current), lazy load all other pages as they become visible (
useIntersection#appear()
) for at least 75ms.Note
This work is behind a feature flag to allow for adequate testing & reasonable fallback
OPENPROJECT_FEATURE_WP_ACTIVITY_TAB_LAZY_PAGINATION_ACTIVE
Merge checklist