Skip to content

Conversation

romgrk
Copy link
Contributor

@romgrk romgrk commented Aug 13, 2025

Follow-up of #19156 (comment)

Remove the state update inside a store effect.

@romgrk romgrk requested a review from cherniavskii August 13, 2025 15:45
@romgrk romgrk added scope: data grid Changes related to the data grid. type: regression A bug, but worse, it used to behave as expected. labels Aug 13, 2025
@mui-bot
Copy link

mui-bot commented Aug 13, 2025

Deploy preview: https://deploy-preview-19178--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 🔺+34B(+0.01%) 🔺+39B(+0.03%)
@mui/x-data-grid-pro 🔺+29B(+0.01%) 🔺+61B(+0.04%)
@mui/x-data-grid-premium 🔺+29B(0.00%) 🔺+38B(+0.02%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 4072ada

@cherniavskii
Copy link
Member

Some tests failed unfortunately

Comment on lines -401 to +406
expect(vi.getTimerCount()).to.equal(3);
expect(vi.getTimerCount()).to.equal(2);

await act(async () => {
await vi.advanceTimersByTimeAsync(100);
});
expect(vi.getTimerCount()).to.equal(1);
expect(vi.getTimerCount()).to.equal(0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I must say I don't understand how useStoreEffect affected this, it doesn't use any timer directly.

@romgrk romgrk marked this pull request as draft August 13, 2025 19:08
@romgrk romgrk marked this pull request as ready for review August 13, 2025 19:18
@romgrk
Copy link
Contributor Author

romgrk commented Aug 13, 2025

The tests are passing, except one argos screenshot but it's the flaky density selector test, so I think this is ready.

@romgrk romgrk marked this pull request as draft August 13, 2025 19:22
@romgrk
Copy link
Contributor Author

romgrk commented Aug 13, 2025

Nevermind, still seeing some weird behavior that doesn't happen on my playground page -_-

@romgrk romgrk marked this pull request as ready for review August 13, 2025 20:07
@romgrk
Copy link
Contributor Author

romgrk commented Aug 13, 2025

Now it seems to be working properly everywhere, ready for review.

const refSetter = (name: keyof typeof refs) => (node: HTMLDivElement | null) => {
if (node && refs[name].current !== node) {
refs[name].current = node;
setRefTick((tick) => tick + 1);
Copy link
Member

Choose a reason for hiding this comment

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

OK, so we need to enforce rerender for ref nodes to be propagated after they're set, and this is why some tests were failing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's specifically for the observeRootNode effect that needs to be reactive on refs.container.current change, but there might be more cases where it's needed. I might want to refactor this away in the future, along with the API refactor.

@romgrk romgrk merged commit 20b1340 into mui:master Aug 14, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: data grid Changes related to the data grid. type: regression A bug, but worse, it used to behave as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants