-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Deprecate the getValue
param for the valueGetter
callback
#3314
Conversation
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.
Wouldn't be simpler to not create new interfaces and add a warning when getValue
is called?
valueGetter: I don't really see the point of using this property instead of a direct row access.
It's useful for when the row structure is nested.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I'm only removing
Would you have an example for |
I was saying to not create new interfaces and only add a warning if
Are you talking about |
I am talking about the |
/** | ||
* Parameters passed when calling `colDef.valueGetter` in the row grouping sequence. | ||
*/ | ||
export interface GridValueGetterSimpleParams<R = any> { |
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 don't think it's worth to create another interface to remove getValue
. In v6 we'll need to remove it. Instead, we could only flag it as deprecated and be cautious to never call it + display warning if someone calls 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.
This interface has other differences than getValue
Once again it's for the grouping process, so it does not have api
or the full rowNode
either for instance.
If you want to fully deprecate getValue
, I can move it's deprecation from GridValueGetterFullParams
to GridCellParams
. That was not the goal of this PR but I'm not agaist the idea.
But for GridValueGetterSimpleParams
I think we do need another interface.
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.
If you want to fully deprecate getValue, I can move it's deprecation from GridValueGetterFullParams to GridCellParams. That was not the goal of this PR but I'm not agaist the idea.
Yes, let's deprecate getValue
entirely. The sooner we do, less work we have for v6.
But for GridValueGetterSimpleParams I think we do need another interface.
For now, it's necessary because the api
is a required property. However, in v6 this interface can be removed.
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'm approving to make #3277 to move faster.
Two things which could be done latter:
- Add a deprecation warning when
getValue
is called - Leave a "TODO v6" note so we can find easily it to remove
- Add to [discussion] Preparing v6 #3287
/** | ||
* Parameters passed when calling `colDef.valueGetter` in the row grouping sequence. | ||
*/ | ||
export interface GridValueGetterSimpleParams<R = any> { |
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.
If you want to fully deprecate getValue, I can move it's deprecation from GridValueGetterFullParams to GridCellParams. That was not the goal of this PR but I'm not agaist the idea.
Yes, let's deprecate getValue
entirely. The sooner we do, less work we have for v6.
But for GridValueGetterSimpleParams I think we do need another interface.
For now, it's necessary because the api
is a required property. However, in v6 this interface can be removed.
Fixes #1564
Extracted from #3277
For #3277 I need to call the
valueGetter
before the column state is initialized to use its value as a grouping key.But at that point I can't use
getBaseCellParams
inuseGridParamsApi
because many api methods / states are not ready yet.I added a
GridValueGetterSimpleParams
interface and makevalueGetter
callable with either the full params or this new interface.It is not a breaking change since the new incomplete interface is only called for new code in #3277.
But I migrated all our examples to be compatible with #3277 and the main friction point is the
getValue
param which is anapiRef
method that I can't use beforeuseGridParamsApi
initialization.We are using this property in 2 callbacks:
getRowClassName
: I can understand the interest of having a wrapper that given a field, handles the potentialvalueGetter
.valueGetter
: I don't really see the point of using this property instead of a direct row access. The main difference is that if a col A usesgetValue('B')
in itsvalueGetter
and if the col B has itself avalueGetter
, it will call it. But I think thisvalueGetter
chain adds a lot of not very usefull complexity and that we should deprecate thegetValue
for thevalueGetter
callback.