-
Notifications
You must be signed in to change notification settings - Fork 62
[WC-3146] Improve virtual scrolling in data grid 2 #1948
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
base: main
Are you sure you want to change the base?
Conversation
735ffa8 to
02cf2af
Compare
packages/pluggableWidgets/datagrid-web/src/model/models/grid.model.ts
Outdated
Show resolved
Hide resolved
packages/pluggableWidgets/datagrid-web/src/model/stores/GridSize.store.ts
Outdated
Show resolved
Hide resolved
packages/pluggableWidgets/datagrid-web/src/model/hooks/useInfiniteControl.tsx
Outdated
Show resolved
Hide resolved
| const lockGridBodyHeight = useCallback((): void => { | ||
| if (isVisible && isInfinite && hasMoreItems && gridBodyHeight === undefined && gridBody) { | ||
| gridSizeStore.setGridBodyHeight(gridBody.clientHeight - offsetBottom); | ||
| } | ||
| }, [isVisible, isInfinite, hasMoreItems, gridBodyHeight, gridBody, gridSizeStore]); |
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.
IMO, this should be an action on GridSizestore. All this deps coming from this store except isVisible. So, I think we can make action and just pass isVisible as argument.
02cf2af to
f5e5ff4
Compare
| import { useInfiniteControl } from "@mendix/widget-plugin-grid/components/InfiniteBody"; | ||
| import { RefObject, UIEventHandler, useCallback } from "react"; | ||
| import { usePaginationService } from "./injection-hooks"; | ||
| import { UIEventHandler } from "react"; |
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.
NIT: this might be removed but, OK :D
| /** | ||
| * const lockGridBodyHeight = useCallback((): void => { | ||
| * if (isVisible && hasVirtualScrolling && hasMoreItems && gridBodyHeight === undefined && gridBody) { | ||
| * gridSizeStore.setGridBodyHeight(gridBody.clientHeight - offsetBottom); | ||
| * } | ||
| * }, [isVisible, hasVirtualScrolling, hasMoreItems, gridBodyHeight, gridBody, gridSizeStore]); | ||
| * | ||
| * useLayoutEffect(() => { | ||
| * setTimeout(() => lockGridBodyHeight(), 100); | ||
| * }, [lockGridBodyHeight]); | ||
| */ |
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.
Comments
f5e5ff4 to
2f7959d
Compare
iobuhov
left a comment
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.
LGTM
Pull request type
Bug fix / New feature
Description
With recent improvements of virtual scrolling we introduced an issue with horizontal scroll where vertical scrollbar goes out of sight. To mitigate this we took a new approach and improved vertical scrolling even more. This gives the users ability scroll in both directions and have more natural look and feel when virtual scrolling is enabled.
As a small feature we introduced shadows when the grid is scrolled, so the users immediately see that the grid is in the middle of the scroll, this is a good QoL improvement.
What should be covered while testing?