@@ -22,6 +22,7 @@ export const Internal = React.forwardRef<InternalRef, CodeMirrorMergeProps>((pro
2222 highlightChanges,
2323 gutter,
2424 collapseUnchanged,
25+ destroyRerender,
2526 renderRevertControl,
2627 ...elmProps
2728 } = props ;
@@ -95,26 +96,28 @@ export const Internal = React.forwardRef<InternalRef, CodeMirrorMergeProps>((pro
9596 } ) ;
9697 }
9798 }
98- view . current ?. destroy ( ) ;
99- view . current = new MergeView ( {
100- a : {
101- ...original ,
102- extensions : [
103- ...( originalExtension ?. extension || [ ] ) ,
104- ...getDefaultExtensions ( { ...originalExtension ?. option , theme } ) ,
105- ] ,
106- } ,
107- b : {
108- ...modified ,
109- extensions : [
110- ...( modifiedExtension ?. extension || [ ] ) ,
111- ...getDefaultExtensions ( { ...modifiedExtension ?. option , theme } ) ,
112- ] ,
113- } ,
114- parent : editor . current ! ,
115- ...opts ,
116- } ) ;
117- } , [ view , theme , editor . current , original , modified , originalExtension , modifiedExtension ] ) ;
99+ if ( destroyRerender ) {
100+ view . current ?. destroy ( ) ;
101+ view . current = new MergeView ( {
102+ a : {
103+ ...original ,
104+ extensions : [
105+ ...( originalExtension ?. extension || [ ] ) ,
106+ ...getDefaultExtensions ( { ...originalExtension ?. option , theme } ) ,
107+ ] ,
108+ } ,
109+ b : {
110+ ...modified ,
111+ extensions : [
112+ ...( modifiedExtension ?. extension || [ ] ) ,
113+ ...getDefaultExtensions ( { ...modifiedExtension ?. option , theme } ) ,
114+ ] ,
115+ } ,
116+ parent : editor . current ! ,
117+ ...opts ,
118+ } ) ;
119+ }
120+ } , [ view , theme , editor . current , original , modified , originalExtension , modifiedExtension , destroyRerender ] ) ;
118121
119122 useEffect ( ( ) => ( ) => view . current && view . current . destroy ( ) , [ ] ) ;
120123
0 commit comments