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

✨ Use InfiniteScroller pattern for the Task Drawer #2049

Merged
merged 5 commits into from
Sep 9, 2024

Conversation

rszwajko
Copy link
Collaborator

@rszwajko rszwajko commented Aug 5, 2024

Implement InfiniteScroller based on oVirt VmPortal implementation and
use it to fetch additional tasks in the Task Drawer.
Key features:

  1. fetch data using useInfiniteQuery from React Query
  2. track sentinel visibility using IntersectionObserver API
  3. monitor item count to prevent extra fetchMore calls

Resolves: #1973
Reference-Url: https://github.com/oVirt/ovirt-web-ui/blob/dfe0c4b8c92638f6e41b9fe0b09e0d07509618ae/src/components/VmsList/index.js#L50
Signed-off-by: Radoslaw Szwajkowski [email protected]

Copy link

codecov bot commented Aug 5, 2024

Codecov Report

Attention: Patch coverage is 13.72549% with 88 lines in your changes missing coverage. Please review.

Project coverage is 42.15%. Comparing base (b654645) to head (d54892f).
Report is 224 commits behind head on main.

Files with missing lines Patch % Lines
.../app/components/task-manager/TaskManagerDrawer.tsx 11.11% 32 Missing ⚠️
...mponents/InfiniteScroller/useVisibilityTracker.tsx 7.69% 24 Missing ⚠️
client/src/app/queries/tasks.ts 10.00% 18 Missing ⚠️
...p/components/InfiniteScroller/InfiniteScroller.tsx 26.31% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2049      +/-   ##
==========================================
+ Coverage   39.20%   42.15%   +2.95%     
==========================================
  Files         146      174      +28     
  Lines        4857     5577     +720     
  Branches     1164     1376     +212     
==========================================
+ Hits         1904     2351     +447     
- Misses       2939     3210     +271     
- Partials       14       16       +2     
Flag Coverage Δ
client 42.15% <13.72%> (+2.95%) ⬆️
server ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rszwajko
Copy link
Collaborator Author

rszwajko commented Aug 14, 2024

Infinite scroller inside Task Drawer

(queries with 2 sec delay to show loading progress)

Screencast.from.2024-08-14.20-36-24.mp4

Implement InfiniteScroller based on oVirt VmPortal implementation and
use it to fetch additional tasks in the Task Drawer.
Key features:
1. fetch data using useInfiniteQuery from React Query
2. track sentinel visibility using IntersectionObserver API
3. monitor item count to prevent extra fetchMore calls

Reference-Url: https://github.com/oVirt/ovirt-web-ui/blob/dfe0c4b8c92638f6e41b9fe0b09e0d07509618ae/src/components/VmsList/index.js#L50
Signed-off-by: Radoslaw Szwajkowski <[email protected]>
@rszwajko rszwajko changed the title ✨ Port InfiniteScroller ✨ Use InfiniteScroller pattern for the Task Drawer Sep 3, 2024
@rszwajko rszwajko marked this pull request as ready for review September 3, 2024 12:15
@rszwajko
Copy link
Collaborator Author

rszwajko commented Sep 3, 2024

@sjd78 @ibolton336
the current version contains log entries and a test page size (2 items) - it makes things easier to test during the review.
I'll remove it before the merge.

Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

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

It is working well, just a few comments and questions.

@rszwajko
Copy link
Collaborator Author

rszwajko commented Sep 5, 2024

@sjd78 @ibolton336
I've removed the extra logs. There is also one code change - extra wrapper to avoid setting the state on unmounted component (which theoretically may happen as IntersectionObserver is browser API)

@sjd78 sjd78 added this to the v0.6.0 milestone Sep 7, 2024
Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

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

LGTM

@rszwajko rszwajko merged commit 7cd3ebb into konveyor:main Sep 9, 2024
13 checks passed
sjd78 added a commit that referenced this pull request Sep 14, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient
 
Reference-Url:  #2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
Shevijacobson pushed a commit to Shevijacobson/tackle2-ui that referenced this pull request Sep 18, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient
 
Reference-Url:  konveyor#2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
Shevijacobson pushed a commit to Shevijacobson/tackle2-ui that referenced this pull request Sep 18, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient

Reference-Url:  konveyor#2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
Signed-off-by: Shevijacobson <[email protected]>
DvoraShechter1 pushed a commit to DvoraShechter1/tackle2-ui that referenced this pull request Sep 19, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient

Reference-Url:  konveyor#2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
Signed-off-by: DvoraShechter1 <[email protected]>
DvoraShechter1 pushed a commit to DvoraShechter1/tackle2-ui that referenced this pull request Sep 19, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient

Reference-Url:  konveyor#2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
Signed-off-by: DvoraShechter1 <[email protected]>
HadasahR pushed a commit to HadasahR/tackle2-ui that referenced this pull request Sep 24, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient

Reference-Url:  konveyor#2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
Signed-off-by: HadasahR <[email protected]>
DvoraShechter1 pushed a commit to DvoraShechter1/tackle2-ui that referenced this pull request Oct 28, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient
 
Reference-Url:  konveyor#2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
sarinailinger pushed a commit to sarinailinger/tackle2-ui that referenced this pull request Oct 30, 2024
Fixes:
1. initial delay in first fetch - root cause was delayed initialization
of sentinel reference

2. extra page fetch request - algorithm based on items count was not
sufficient
 
Reference-Url:  konveyor#2049

Signed-off-by: Radoslaw Szwajkowski <[email protected]>
Co-authored-by: Scott Dickerson <[email protected]>
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] Task Manager Drawer - scroll the list to fetch more tasks to display
2 participants