-
Notifications
You must be signed in to change notification settings - Fork 484
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
Validate when there is no query but a JSON file is loaded #383
Conversation
b32a20a
to
98c000b
Compare
Codecov Report
@@ Coverage Diff @@
## master #383 +/- ##
==========================================
+ Coverage 88.72% 88.75% +0.02%
==========================================
Files 159 159
Lines 3556 3556
Branches 811 813 +2
==========================================
+ Hits 3155 3156 +1
+ Misses 365 364 -1
Partials 36 36
Continue to review full report at Codecov.
|
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.
Thanks for this PR!
It seems like queryOfResults
should be undefined
when uploading a JSON without searching, not null
.
@@ -71,7 +71,7 @@ export class SearchTracePageImpl extends Component { | |||
|
|||
goToTrace = traceID => { | |||
const { queryOfResults } = this.props; | |||
const searchUrl = getUrl(stripEmbeddedState(queryOfResults)); | |||
const searchUrl = queryOfResults !== null ? getUrl(stripEmbeddedState(queryOfResults)) : getUrl(); |
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 seems as though queryOfResults
should be of type SearchQuery
or undefined
, never null
.
in mapStateToProps
props.queryOfResults
comes from reduxState.trace.search.query
which is an optional property of type SearchQuery
. null
is not assignable to optional properties.
I think this could simply be: const searchUrl = queryOfResults ? getUrl(stripEmbeddedState(queryOfResults)) : getUrl();
Same for SearchResults/index.js
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.
+1 I'll do the 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.
Done!
@@ -132,7 +132,7 @@ export default class SearchResults extends React.PureComponent<SearchResultsProp | |||
); | |||
} | |||
const cohortIds = new Set(diffCohort.map(datum => datum.id)); | |||
const searchUrl = getUrl(stripEmbeddedState(queryOfResults)); | |||
const searchUrl = queryOfResults !== null ? getUrl(stripEmbeddedState(queryOfResults)) : getUrl(); |
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.
src/components/SearchTracePage/
isn't fully covered by TypeScript yet, but it would be nice for the type SearchResultsProps
to have queryOfResults
as optional. That way it'll be easier to transition to TS in the future, and serve as accurate documentation in the interim.
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, idea! I did the changes.
Signed-off-by: Ruben Vargas <[email protected]>
98c000b
to
69d91a8
Compare
Handle no search query when a JSON file is loaded Signed-off-by: vvvprabhakar <[email protected]>
Which problem is this PR solving?
Short description of the changes