1- import { Component , createRef } from 'react' ;
2- import DocumentTitle from 'react-document-title' ;
1+ import { Component } from 'react' ;
32import styled from '@emotion/styled' ;
43
54import { fetchOrgMembers } from 'sentry/actionCreators/members' ;
@@ -10,6 +9,7 @@ import * as Layout from 'sentry/components/layouts/thirds';
109import LoadingError from 'sentry/components/loadingError' ;
1110import LoadingIndicator from 'sentry/components/loadingIndicator' ;
1211import MissingProjectMembership from 'sentry/components/projects/missingProjectMembership' ;
12+ import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle' ;
1313import { t } from 'sentry/locale' ;
1414import SentryTypes from 'sentry/sentryTypes' ;
1515import MemberListStore from 'sentry/stores/memberListStore' ;
@@ -101,7 +101,7 @@ class ProjectContext extends Component<Props, State> {
101101 }
102102 }
103103
104- componentDidUpdate ( prevProps : Props , prevState : State ) {
104+ componentDidUpdate ( prevProps : Props , _prevState : State ) {
105105 if ( prevProps . projectId !== this . props . projectId ) {
106106 this . fetchData ( ) ;
107107 }
@@ -116,32 +116,13 @@ class ProjectContext extends Component<Props, State> {
116116 if ( prevProps . projects . length !== this . props . projects . length ) {
117117 this . fetchData ( ) ;
118118 }
119-
120- // Call forceUpdate() on <DocumentTitle/> if either project or organization
121- // state has changed. This is because <DocumentTitle/>'s shouldComponentUpdate()
122- // returns false unless props differ; meaning context changes for project/org
123- // do NOT trigger renders for <DocumentTitle/> OR any subchildren. The end result
124- // being that child elements that listen for context changes on project/org will
125- // NOT update (without this hack).
126- // See: https://github.com/gaearon/react-document-title/issues/35
127-
128- // intentionally shallow comparing references
129- if ( prevState . project !== this . state . project ) {
130- const docTitle = this . docTitleRef . current ;
131- if ( ! docTitle ) {
132- return ;
133- }
134- docTitle . forceUpdate ( ) ;
135- }
136119 }
137120
138121 componentWillUnmount ( ) {
139122 this . unsubscribeMembers ( ) ;
140123 this . unsubscribeProjects ( ) ;
141124 }
142125
143- docTitleRef = createRef < DocumentTitle > ( ) ;
144-
145126 unsubscribeProjects = ProjectsStore . listen (
146127 ( projectIds : Set < string > ) => this . onProjectChange ( projectIds ) ,
147128 undefined
@@ -287,9 +268,9 @@ class ProjectContext extends Component<Props, State> {
287268
288269 render ( ) {
289270 return (
290- < DocumentTitle ref = { this . docTitleRef } title = { this . getTitle ( ) } >
271+ < SentryDocumentTitle noSuffix title = { this . getTitle ( ) } >
291272 { this . renderBody ( ) }
292- </ DocumentTitle >
273+ </ SentryDocumentTitle >
293274 ) ;
294275 }
295276}
0 commit comments