File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,6 @@ export default class Dispatcher extends Component {
22
22
this . emitChange ( ) ;
23
23
}
24
24
25
- componentWillUnmount ( ) {
26
- const { helmetInstances } = this . props . context ;
27
- helmetInstances . remove ( this ) ;
28
- this . emitChange ( ) ;
29
- }
30
-
31
25
emitChange ( ) {
32
26
const { helmetInstances, setHelmet } = this . props . context ;
33
27
let serverState = null ;
Original file line number Diff line number Diff line change @@ -16,6 +16,14 @@ export default class HelmetData {
16
16
helmetInstances : {
17
17
get : ( ) => ( this . canUseDOM ? instances : this . instances ) ,
18
18
add : instance => {
19
+ const alreadyHasSameInstance = ( this . canUseDOM ? instances : this . instances ) . filter ( instance => {
20
+ const a = Object . entries ( { ...instance . props , context : undefined } ) . sort ( ) ;
21
+ const b = Object . entries ( { ...this . props , context : undefined } ) . sort ( ) ;
22
+ return JSON . stringify ( a ) === JSON . stringify ( b ) ;
23
+ } ) . length > 0 ;
24
+ if ( alreadyHasSameInstance ) {
25
+ return ;
26
+ }
19
27
( this . canUseDOM ? instances : this . instances ) . push ( instance ) ;
20
28
} ,
21
29
remove : instance => {
You can’t perform that action at this time.
0 commit comments