Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] Avoid
<GridRoot />
double-render pass on mount in SPA mode #15648[DataGrid] Avoid
<GridRoot />
double-render pass on mount in SPA mode #15648Changes from 13 commits
c0944e1
ad08bcd
2ff2567
128234a
8da261b
e680805
eb491c6
8d2a78d
c8580d9
c459ad6
01cbb00
d4707a1
5ca918f
9cd2134
4287d0a
903554e
91cd557
20f87a0
a51aa8e
6d01710
063c0b0
f87588c
95f3f08
8fdcb8c
d6ee4a2
2eab88c
f709da6
7313c34
52c051d
5cc425f
0b1f757
4514cd4
b861e41
b366708
9176ec0
f29dfbc
6995ed7
4b7f544
1495b06
d4eb696
35cf5e3
631c6b6
1397dbc
2ee5a28
8bb087e
30c10ba
14c42f4
989811c
0a91c02
c19f001
f88d9a2
0ecb2dd
73d0ff7
6201f02
c4190fb
9f5a709
051db9c
666bf4c
94a1caf
e6c32a9
b72df72
5b8686d
68e79df
663a5dd
7a93d2e
f9f250c
18e4361
4388740
4c3fda2
bed334e
281bd96
9cfa9d9
24b5ae0
a66231d
fcd3c9c
9c72ea7
10bdcd8
bf8bcf4
ac18ea5
fc18204
0cfce51
4325795
8932863
c2f90cb
b600821
c78076c
bc44121
e8b451c
5b0df33
5e4eb36
c42a435
f2b57b0
008bf87
cf2cd66
d8e7f0c
51eea10
abcd947
53b1e82
560a436
c3f54b3
1c5fc8c
bbcb8a3
3a57406
ffa1efc
0fc0226
ae6cc13
34f24b3
56f75fa
2415b59
b63c07a
37cf769
b10a81f
45f70a1
d92c4d8
43829e8
25998ec
e6399e2
d4b652b
9f95fee
32e4dc2
bae6d94
cddb1bf
74d77a9
e8963eb
5d0109b
12e0e74
ee91dbc
3449782
4c5fa74
26be717
b4ab00c
eb577a3
d628881
9760a27
7005366
680d823
af40788
0b6bcda
676da6b
76fb889
f8ca726
e45e07a
bab03a8
1c5e1d2
9708bf1
c0f1205
6bbf36d
6bc48b2
86d2dcc
3771d7a
fa21f18
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Sidenote: if we're adding this dependency now, we could replace our
Store
/useGridSelector
implementation with it. I don't remember why I didn't use it back then.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.
I noticed this weird behavior in some demos: https://deploy-preview-15648--material-ui-x.netlify.app/x/react-data-grid/#community-version
Screen.Recording.2025-01-30.at.23.46.23.mov
Looks like it only happens when the initial render is on the server (Argos did not catch this issue since we only use client rendering for screenshots).
I'll look into it.
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.
Thanks! Seems to be a timing issue with
useGridSelector
. Dimensions get initialised in a ref callback, which runs beforeuseLayoutEffect
and after the body of the hook. Subscription is added after the state is set, which doesn't catch the update. I guess the root cause always existed, it's just that extraneous state updates masked it (e.g. runninghydrateRowsMeta
twice in a row as it did before allowed the subscription to catch the second update).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.
It works with
useInsertionEffect
(2415b59). But needs a fallback for React 17, as it only exists from React 18.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.
Hmm, shouldn't we use
useSyncExternalStore
for subscription here?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.
We could fallback to
useLayoutEffect
in React 17, but also need to callapplySelector
once more before subscription:https://www.npmjs.com/package/@emotion/use-insertion-effect-with-fallbacks
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.
Strange, the headers work fine on my end (tried refreshing / resetting the demo, etc). What browser?
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.
Tried Edge, Chrome, Safari, Firefox – all work on Mac at least.
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.
Ok, managed to reproduce it – had to switch to light mode. No idea what's causing it though. Dark mode works perfectly. Also works well in our app.
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.
This is so weird 🤔
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.
Fixed :)
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.