-
Notifications
You must be signed in to change notification settings - Fork 31
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
fix: Console error when opening context menu on tree table #2047
fix: Console error when opening context menu on tree table #2047
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2047 +/- ##
=======================================
Coverage 46.36% 46.36%
=======================================
Files 673 673
Lines 38780 38779 -1
Branches 9826 9826
=======================================
Hits 17981 17981
+ Misses 20748 20747 -1
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
resultRow.push( | ||
formatValue(viewportRow.data.get(c)?.value, this.columns[c]) | ||
formatValue?.(viewportRow.data.get(c)?.value, this.columns[c]) |
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.
Seems if formatValue
is not defined, there is no point in entering the for loop at all. I would check before the loop.
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.
Good catch, just tested and it seems like this also works, but definitely more efficient (since we are not going into the loop if its not defined anymore). Pushed change
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.
Code changes look good. I confirmed the error no longer shows up when opening the context menu on tree table.
c += 1 | ||
) { | ||
resultRow.push( | ||
formatValue(viewportRow.data.get(c)?.value, this.columns[c]) |
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 still want to populate the resultRow
array with unformatted values if formatValue
is not defined.
With this change, the resultRow
ends up empty.
Resolves #2029
Changes Implemented:
I had also considered the approach below, which achieved the same result of removing the exception in the console. Ultimately opted to not use this logic, under the assumption that we are okay with the
resultRow
beingundefined
.However, if we want
resultRow
to be defined, this approach ensures that it is, via a default function that performs no formatting.