-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[data grid] onRowsScrollEnd
fired without scrolling
#4371
Comments
onRowsScrollEnd
isn't fired on scroll endonRowsScrollEnd
fired without scrolling
onRowsScrollEnd
fired without scrollingonRowsScrollEnd
fired without scrolling
#7416 this pr can solve infinite scroll issue, pls take a look ya. |
hey @cherniavskii there was a problem with scrollEnd detection. $ git diff 'packages\grid\x-data-grid-pro\src\hooks\features\infiniteLoader\useGridInfiniteLoader.ts'
diff --git a/packages/grid/x-data-grid-pro/src/hooks/features/infiniteLoader/useGridInfiniteLoader.ts b/packages/grid/x-data-grid-pro/src/hooks/features/infiniteLoader/useGridInfiniteLoader.ts
index fbe62f935..4ebdf2c74 100644
--- a/packages/grid/x-data-grid-pro/src/hooks/features/infiniteLoader/useGridInfiniteLoader.ts
+++ b/packages/grid/x-data-grid-pro/src/hooks/features/infiniteLoader/useGridInfiniteLoader.ts
@@ -43,15 +43,11 @@ export const useGridInfiniteLoader = (
if (scrollPositionBottom < contentHeight - props.scrollEndThreshold) {
isInScrollBottomArea.current = false;
}
- if (
- scrollPositionBottom >= contentHeight - props.scrollEndThreshold &&
- !isInScrollBottomArea.current
- ) {
+ if (scrollPositionBottom >= contentHeight - props.scrollEndThreshold) {
const rowScrollEndParam: GridRowScrollEndParams = {
visibleColumns,
viewportPageSize, |
I dont think onRowsScrollEnd callback is a proper way for infinite scroll. #7416 check this PR's video... |
hey @liho00
mui-x/packages/grid/x-data-grid-pro/src/hooks/features/infiniteLoader/useGridInfiniteLoader.ts Lines 46 to 50 in 0203346
|
@yaredtsy nope,
Screen.Recording.2023-01-07.at.8.23.03.PM.movthe video is the result with onRowsScrollEnd
|
not mui-x/packages/grid/x-data-grid-pro/src/hooks/features/infiniteLoader/useGridInfiniteLoader.ts Lines 74 to 79 in 0203346
check this demo, |
Passing About the event being fired even without scroll, I think it's the correct behavior, although the name might be wrong. I see the event as a way to detect if the bottom edge of the content is visible, also understood as if the last row is visible. In the example given, the number of rows is so small that since the beginning the bottom edge of the content is already visible. The event has nothing to do with scrolling but we use the scroll event to detect if it should be published or not. |
I do not think setting |
https://codesandbox.io/s/gifted-einstein-o1xc0e?file=/demo.tsx @m4theushw yes But I would like to recommend that Intersection Observer js api is the right & simple way for infinite scroll in this PR #7416 |
@liho00 You're using @yaredtsy You've set the wrong prop. |
nope u are trying 5 items with 400px heigh thats why no issues (second loaded items come with scrollbar which will be working fine), please try load 1 item with Grid height 400px or 2items with Grid height 800px, please also study my PR's problem statement, thanks in advance! #7416 |
@liho00 I understand the problem. Unfortunately, The cc @DanailH |
Hey @m4theushw, I don't think that changing it to |
@yaredtsy That's the idea when I proposed to use |
A quick note: I've explored the idea of using the To avoid this another solution is to add a specific |
@DanailH
btw I think I no need to update my PR #7416, which implemented by using extra div. |
|
Duplicates
Latest version
Current behavior 😯
onRowsScrollEnd
is called (even though there was no scroll event)onRowsScrollEnd
anymoreScreen.Recording.2022-04-05.at.17.02.27.mov
Expected behavior 🤔
onRowsScrollEnd
is not called, since there's no scroll eventSteps to reproduce 🕹
Steps:
Context 🔦
I've noticed it while investigating #4184
Your environment 🌎
`npx @mui/envinfo`
Order ID 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: