Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidUpdate(prevProps) {
const props = this.props;
// Prevent infinite loop in case React Router decides to destroy & recreate the component (changing key)
const oldLocation = _.omit(prevProps.location, ['key']);
const newLocation = _.omit(props.location, ['key']);
if (_.isEqual(newLocation, oldLocation) && _.isEqual(props.match, prevProps.match)) {
return;
}
// two way data binding :-/
const { pathname } = props.location;
store.dispatch(UIActions.setCurrentLocation(pathname));
}
componentWillReceiveProps(nextProps) {
if (_.isEqual(nextProps, this.props)) {
return;
}
this.clock += 1;
// Don't show stale data if we changed the query.
this.setState({
status: '...',
short: undefined,
long: undefined,
});
this.fetch(nextProps);
}
services,
statefulSets,
selectedGroup,
} = this.props;
if (namespace !== prevProps.namespace
|| loaded !== prevProps.loaded
|| !_.isEqual(buildConfigs, prevProps.buildConfigs)
|| !_.isEqual(builds, prevProps.builds)
|| !_.isEqual(daemonSets, prevProps.daemonSets)
|| !_.isEqual(deploymentConfigs, prevProps.deploymentConfigs)
|| !_.isEqual(deployments, prevProps.deployments)
|| !_.isEqual(pods, prevProps.pods)
|| !_.isEqual(replicaSets, prevProps.replicaSets)
|| !_.isEqual(replicationControllers, prevProps.replicationControllers)
|| !_.isEqual(routes, prevProps.routes)
|| !_.isEqual(services, prevProps.services)
|| !_.isEqual(statefulSets, prevProps.statefulSets)) {
this.createOverviewData();
} else if (filterValue !== prevProps.filterValue) {
const filteredItems = this.filterItems(this.state.items);
this.setState({
filteredItems,
groupedItems: groupItems(filteredItems, selectedGroup),
});
} else if (selectedGroup !== prevProps.selectedGroup) {
this.setState({
groupedItems: groupItems(this.state.filteredItems, selectedGroup),
});
}
// Fetch new metrics when the namespace changes.
componentDidUpdate(prevProps: ResultProps): void {
if (!isEqual(this.props.commerceData, prevProps.commerceData)) {
if (!this.props.disableReviews) {
this.requestReviews().catch(err => console.warn('Could not get reviews', err));
}
if (this.props.onReceiveCommerceData && this.state.commerceData) {
this.props.onReceiveCommerceData(this.state.commerceData);
}
}
}
replicationControllers,
routes,
services,
statefulSets,
selectedGroup,
} = this.props;
if (namespace !== prevProps.namespace
|| loaded !== prevProps.loaded
|| !_.isEqual(buildConfigs, prevProps.buildConfigs)
|| !_.isEqual(builds, prevProps.builds)
|| !_.isEqual(daemonSets, prevProps.daemonSets)
|| !_.isEqual(deploymentConfigs, prevProps.deploymentConfigs)
|| !_.isEqual(deployments, prevProps.deployments)
|| !_.isEqual(pods, prevProps.pods)
|| !_.isEqual(replicaSets, prevProps.replicaSets)
|| !_.isEqual(replicationControllers, prevProps.replicationControllers)
|| !_.isEqual(routes, prevProps.routes)
|| !_.isEqual(services, prevProps.services)
|| !_.isEqual(statefulSets, prevProps.statefulSets)) {
this.createOverviewData();
} else if (filterValue !== prevProps.filterValue) {
const filteredItems = this.filterItems(this.state.items);
this.setState({
filteredItems,
groupedItems: groupItems(filteredItems, selectedGroup),
});
} else if (selectedGroup !== prevProps.selectedGroup) {
this.setState({
groupedItems: groupItems(this.state.filteredItems, selectedGroup),
});
}
.filter(f => f.required || !_.isEqual(formValues[f.path], defaultValueFor(f)))
.reduce((allErrors, field) => {
onPermissionChange = (key, value) => {
const permissions = { ...this.state.permissions, [key]: value };
this.setState({
changed: !isEqual(permissions, this.props.apiKey.permissions),
permissions
});
};
_.each(configMaps.items, (v) => {
cmItems[`${v.metadata.name}:${cmRefProperty}`] = (
);
if (kind === 'ConfigMap' && _.isEqual(v.metadata.name, name)) {
refProperty = cmRefProperty;
itemKeys = getKeys(v.data);
}
});
_.each(secrets.items, (v) => {
shouldComponentUpdate(nextProps: IProps) {
const { styleDef } = this.props
return !isEqual(styleDef, nextProps.styleDef)
}
deploymentConfigs,
filterValue,
loaded,
namespace,
pods,
replicaSets,
replicationControllers,
routes,
services,
statefulSets,
selectedGroup,
} = this.props;
if (namespace !== prevProps.namespace
|| loaded !== prevProps.loaded
|| !_.isEqual(buildConfigs, prevProps.buildConfigs)
|| !_.isEqual(builds, prevProps.builds)
|| !_.isEqual(daemonSets, prevProps.daemonSets)
|| !_.isEqual(deploymentConfigs, prevProps.deploymentConfigs)
|| !_.isEqual(deployments, prevProps.deployments)
|| !_.isEqual(pods, prevProps.pods)
|| !_.isEqual(replicaSets, prevProps.replicaSets)
|| !_.isEqual(replicationControllers, prevProps.replicationControllers)
|| !_.isEqual(routes, prevProps.routes)
|| !_.isEqual(services, prevProps.services)
|| !_.isEqual(statefulSets, prevProps.statefulSets)) {
this.createOverviewData();
} else if (filterValue !== prevProps.filterValue) {
const filteredItems = this.filterItems(this.state.items);
this.setState({
filteredItems,
groupedItems: groupItems(filteredItems, selectedGroup),