Browse Source

ref(ui) Remove unsafe method usage from withReleaseRepos (#27501)

Follow up from the createReactClass cleanup. Move the activeRepo updates
to componentDidUpdate instead of using willReceiveProps
Mark Story 3 years ago
parent
commit
65de38d7b1
1 changed files with 4 additions and 5 deletions
  1. 4 5
      static/app/views/releases/detail/withReleaseRepos.tsx

+ 4 - 5
static/app/views/releases/detail/withReleaseRepos.tsx

@@ -51,10 +51,6 @@ function withReleaseRepos<P extends DependentProps>(
       this.fetchReleaseRepos();
       this.fetchReleaseRepos();
     }
     }
 
 
-    UNSAFE_componentWillReceiveProps(nextProps: P & HoCsProps) {
-      this.setActiveReleaseRepo(nextProps);
-    }
-
     componentDidUpdate(prevProps: P & HoCsProps, prevState: State) {
     componentDidUpdate(prevProps: P & HoCsProps, prevState: State) {
       if (
       if (
         this.props.params.release !== prevProps.params.release ||
         this.props.params.release !== prevProps.params.release ||
@@ -64,7 +60,10 @@ function withReleaseRepos<P extends DependentProps>(
         return;
         return;
       }
       }
 
 
-      if (prevState.releaseRepos.length !== this.state.releaseRepos.length) {
+      if (
+        prevState.releaseRepos.length !== this.state.releaseRepos.length ||
+        prevProps.location.query?.activeRepo !== this.props.location.query?.activeRepo
+      ) {
         this.setActiveReleaseRepo(this.props);
         this.setActiveReleaseRepo(this.props);
       }
       }
     }
     }