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

[DataGrid] Fix last row #1071

Merged
merged 3 commits into from
Feb 23, 2021
Merged

[DataGrid] Fix last row #1071

merged 3 commits into from
Feb 23, 2021

Conversation

dtassone
Copy link
Member

@dtassone dtassone commented Feb 17, 2021

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

How do we test or a reproduction for the issue? For instance, a codesandbox where we can see the issue?

@oliviertassinari oliviertassinari changed the title [DataGrid] fix last row [DataGrid] Fix last row Feb 17, 2021
@dtassone
Copy link
Member Author

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Thanks for the reproduction. Please always describe the problem a pull request is solving. It's important for blaming changes in the future (it's not infrequent we need to understand 1 or 2 years old changes). It's also important for reviews, we can't review without knowing what problem we solve.

In this case, I think that we should have a test case, it looks important. I'm not sure a visual test would be best because the problem and solution seem Math related, so more a unit or end-to-end one.

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Feb 19, 2021
@dtassone
Copy link
Member Author

As discussed this will be tested using the regression image snapshot tests

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

I think that we need a test because virtualization is tricky. It would be much better to be able to feel confident when refactoring it.

@dtassone
Copy link
Member Author

I added a story that scrolls to the bottom, just need to setup an image test

const apiRef = useGridApiRef();

React.useEffect(() => {
const timeout = setTimeout(() => {
Copy link
Member

@oliviertassinari oliviertassinari Feb 22, 2021

Choose a reason for hiding this comment

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

The visual tests are waiting in a useEffect: https://github.com/mui-org/material-ui-x/pull/1081/files#diff-df56773d39f0fa9c8f39611f1993bf7df81d046c5d055a47365fccb494407de0R63. It's not waiting for this timeout to run. It won't screenshot it correctly at the right time. So it doesn't work (at least shouldn't in theory or be flaky). What's the setTimeout for?

Copy link
Member Author

Choose a reason for hiding this comment

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

we have to wait until everything is rendered before we can move the scroll down. It seems to only work in a timeout.
I tried with useLayoutEffect...

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

I'm approving even if we don't have an automated test for this. We still have a reproduction that the next person that will blame this line can find to reproduce. It's still a lot more inefficient than having an automated test that can run quickly (not a screenshot) but it's better than nothing.

I really don't think that virtualization should be tested with visual regressions. Visual regression should be about any problem that is CSS related. This isn't one. @dtassone If you have time, please add an automated test, otherwise fine, we can live without, and delay the cost to later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants