-
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
Merged
Merged
fix: time series table #7302
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 fragileThere 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 ofTimeSeriesColumnControl
when loading a time series table chart I see the other props likecolType
d3format
set that correspond to state properties. You mentioned in chat thato
passed to theControl
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.