aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/app/components/ComponentContainer.tsx')
-rw-r--r--server/sonar-web/src/main/js/app/components/ComponentContainer.tsx15
1 files changed, 12 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
index 176a21d06ac..00e376c5dfc 100644
--- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
@@ -244,9 +244,15 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
return !task.branch && !task.pullRequest;
};
- handleComponentChange = (changes: {}) => {
+ handleComponentChange = (changes: Partial<Component>) => {
if (this.mounted) {
- this.setState(state => ({ component: { ...state.component, ...changes } }));
+ this.setState(state => {
+ if (state.component) {
+ const newComponent: Component = { ...state.component, ...changes };
+ return { component: newComponent };
+ }
+ return null;
+ });
}
};
@@ -309,4 +315,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> {
const mapDispatchToProps = { fetchOrganizations };
-export default connect<any, any, any>(null, mapDispatchToProps)(ComponentContainer);
+export default connect<any, any, any>(
+ null,
+ mapDispatchToProps
+)(ComponentContainer);