Check object instanceof on all detail panels (#4054)

* Check object instanceof on all detail panels

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix unit tests

- Remove prettier as snapShot testing is too tight of a bound

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-10-15 12:11:46 -04:00
1 parent dabfce3609
commit 052d12fc19
32 files changed
+392 -168

No files matched your search

@@ -33,8 +33,9 @@ import { base64 } from "../../utils";
import { Icon } from "../icon";
import { secretsStore } from "./secrets.store";
import type { KubeObjectDetailsProps } from "../kube-object-details";
import type { Secret } from "../../../common/k8s-api/endpoints";
import { Secret } from "../../../common/k8s-api/endpoints";
import { KubeObjectMeta } from "../kube-object-meta";
import logger from "../../../common/logger";
interface Props extends KubeObjectDetailsProps<Secret> {
}
@@ -84,7 +85,15 @@ export class SecretDetails extends React.Component<Props> {
render() {
const { object: secret } = this.props;
if (!secret) return null;
if (!secret) {
return null;
}
if (!(secret instanceof Secret)) {
logger.error("[SecretDetails]: passed object that is not an instanceof Secret", secret);
return null;
}
return (
<div className="SecretDetails">