-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
cluster-ui: fix insights page crash #120137
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.
Thanks for fixing this!
@@ -564,7 +564,7 @@ export class Filter extends React.Component<QueryFilter, FilterState> { | |||
})) | |||
: []; | |||
const schemaInsightTypeValue = schemaInsightTypeOptions.filter(option => { | |||
return filters.schemaInsightType.split(",").includes(option.label); | |||
return filters.schemaInsightType?.split(",").includes(option.label); |
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 we're changing this code anyways, can we create the array (or set) outside of the filter fn:
const selectedSchemaInsightTypes = filters.schemaInsightType?.split(",") ?? [];
const schemaInsightTypeValue = schemaInsightTypeOptions.filter(option => selectedSchemaInsightTypes.includes(option.label);
);
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! I went ahead and fixed all the other issues of the same type in the file since we see these errors in the console logs quite frequently.
4838010
to
4727609
Compare
When the Schema Insights Type is unitialized, the Schema Insights tab would crash because a string method was being called on `undefined`. The types are all correct, but because strict mode isn't enabled, it's not considered a type error. Now the string method is only called if the Schema Insights Type is defined. The same type issue that was fixed for `filters.schemaInsightType` was fixed for all other filters in the same file as well. Fixes: https://cockroachlabs.atlassian.net/browse/CC-27391 Release note (bug fix): Fixes intermittent page crash on the Schema Insights view.
4727609
to
a22845e
Compare
TFTR @xinhaoz! |
bors r+ |
blathers backport 23.2 |
Build succeeded: |
When the Schema Insights Type is unitialized, the Schema Insights tab would crash because a string method was being called on
undefined
. The types are all correct, but because strict mode isn't enabled, it's not considered a type error.Now the string method is only called if the Schema Insights Type is defined.
Fixes: https://cockroachlabs.atlassian.net/browse/CC-27391
Release note (bug fix): Fixes intermittent page crash on the Schema Insights view.