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 {
2222 this . emitChange ( ) ;
2323 }
2424
25- componentWillUnmount ( ) {
26- const { helmetInstances } = this . props . context ;
27- helmetInstances . remove ( this ) ;
28- this . emitChange ( ) ;
29- }
30-
3125 emitChange ( ) {
3226 const { helmetInstances, setHelmet } = this . props . context ;
3327 let serverState = null ;
Original file line number Diff line number Diff line change @@ -16,6 +16,14 @@ export default class HelmetData {
1616 helmetInstances : {
1717 get : ( ) => ( this . canUseDOM ? instances : this . instances ) ,
1818 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+ }
1927 ( this . canUseDOM ? instances : this . instances ) . push ( instance ) ;
2028 } ,
2129 remove : instance => {
You can’t perform that action at this time.
0 commit comments