-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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: time series table #7302
fix: time series table #7302
Conversation
Codecov Report
@@ Coverage Diff @@
## lyftga #7302 +/- ##
=======================================
Coverage 64.58% 64.58%
=======================================
Files 425 425
Lines 20884 20884
Branches 2297 2297
=======================================
Hits 13488 13488
Misses 7270 7270
Partials 126 126
Continue to review full report at Codecov.
|
Adding @michellethomas to this PR |
bounds: [null, null], | ||
d3format: '', | ||
dateFormat: '', | ||
}; |
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.
Previously state was set to what's in props const state = { ...props }
, should these be set to the values in props instead of nulls and empty strings? It would also be good to explicitly state what's in props and list them as either required or list them in defaultProps.
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.
None of the properties in props correspond to state properties except label.
The line I removed is definitely confusing to read. It leads the reader to believe that props has values like "colType", "width", etc. when in actuality it has none of these properties.
Listing out the state properties should improve readability.
I've also added a default value for label in props.
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.
You can also see in the screenshot all the random properties we add to state that leads to a bad request to the backend.
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.
Instead of adding null
values and empty strings, can we just omit them? The consumer of that object should be the thing that decides a) if it wants those values to be there and b) what to do if they are missing. Inserting them here seems like it is coupling things in a way that is going to be fragile
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.
Nvm, @khtruong I think that works just as a declaration of "here are the fields and initial values that this type cares about". I was thinking it was being used differently.
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.
Are you printing out the this.props from CollectionControl
? When I look at props from within the constructor of TimeSeriesColumnControl
when loading a time series table chart I see the other props like colType
d3format
set that correspond to state properties. You mentioned in chat that o
passed to the Control
is undefined, on master it looks like it's getting set correctly. Are there any changes in lyftga that could have affected this?
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.
Ahh I see what is going on. I was looking into this.props and you were referring to this.props.value. Yes, I can set the state to what is stored in this.props.values.
Also ignore my comment about o being undefined. I was within the map function's scope when I tried to look up this.props which was undefined within that scope.
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.
Talked to Michelle offline. Turns out she was looking at the props with Max's changes and I was looking at the props without Max's changes. Hehe.
Now I have set state to the prop values if they exist. Otherwise, they are sent to default values.
* fix: time series table * fix: add default value for label * fix: use prop values if defined * fix: revert CollectionControl changes (cherry picked from commit 5dab983)
CATEGORY
Choose one
SUMMARY
There are various issues with the time series table:
The problem is that we pass and save all props as state properties in the TimeSeriesColumnControl. When we make a backend request, we pass all the state properties as form data. Some of these properties do not make sense (i.e. a function to render the tooltip) and thus the request fails.
The fix is to be explicit about the state properties so that we only pass back relevant and comprehensible properties to the backend.
@mistercrunch This addresses some of the issues you were trying to fix in #6959. I think we should be explicit in our state properties versus adding the prop passthroughProps.
TEST PLAN
Tested manually
ADDITIONAL INFORMATION
REVIEWERS
@mistercrunch @xtinec @betodealmeida @DiggidyDave @datability-io