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] Refactor rendering, remove rafUpdate #532
[DataGrid] Refactor rendering, remove rafUpdate #532
Changes from 2 commits
abe63f3
7dd3cd5
6520205
9ed2d05
dc1fe69
8e2e989
3eb1537
7af936c
99a1833
fcadbe0
254d070
d85aa37
6d38055
e0289cd
fa9bc7f
cf0aa5e
bd72f93
58ee78c
112b830
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.
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.
Why? I prefer to useState so I can pass the state I need...
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.
The current usage force you to call forceUpdate with an argument, and it has to have a unique reference, like a new object or a state setting that returns a unique reference. In the current logic, it's called with a function. It could be simpler if it didn't need to accept an argument, and maybe less error prone?
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 does, you just need to pass a function
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.
The name
forceUpdate
is misleading. You have to pass the correct parameter to schedule work.Though generally forcing a re-render is rarely needed. Whenever you
forceUpdate
why can't you move whatever changed into state?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.
There is one case that took me some time to understand, I think that by doing
We can skip updates when the state hasn't changed, which can be an interesting feature. I was confused by the name, we definitely need to find a different one. IMHO
forceUpdate
=== no arguments. What aboutsetState
?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 not a setState, it's just to force the ui to rerender
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.
@dtassone Are you saying that all we need is a new reference? If its the case, I would rather do:
to remove the dependency another part of the logic.
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.
But it is? Assuming you refer to
setState
returned from theuseState
hook then I don't see any difference. BothsetState
andforceUpdate
have to know what the current state is to actually force a re-rerender (which isn't clear why you need this).This file was deleted.
This file was deleted.