Skip to content

Commit 6708e6e

Browse files
committedMay 19, 2023
fix(merge): fix onChange props. (#502)
1 parent 162a191 commit 6708e6e

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed
 

‎merge/src/Internal.tsx

+8-17
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,20 @@ export const Internal = React.forwardRef((props: CodeMirrorMergeProps, ref?: Rea
6060
if (otherStore.collapseUnchanged !== collapseUnchanged) {
6161
opts.collapseUnchanged = collapseUnchanged;
6262
}
63-
if (Object.keys(opts).length && dispatch && original && modified && editor.current) {
63+
if (Object.keys(opts).length && dispatch) {
64+
dispatch({ ...opts });
65+
}
66+
if (original && modified && editor.current) {
6467
view.destroy();
65-
const viewDefault = new MergeView({
66-
a: original,
67-
b: modified,
68+
new MergeView({
69+
a: { ...original },
70+
b: { ...modified },
6871
parent: editor.current,
6972
...opts,
7073
});
71-
dispatch({ ...opts, renderRevertControl, view: viewDefault });
7274
}
7375
}
74-
}, [
75-
view,
76-
original,
77-
modified,
78-
editor,
79-
orientation,
80-
revertControls,
81-
highlightChanges,
82-
gutter,
83-
collapseUnchanged,
84-
renderRevertControl,
85-
]);
76+
}, [view, original, modified, editor, orientation, revertControls, highlightChanges, gutter, collapseUnchanged]);
8677

8778
const defaultClassNames = 'cm-merge-theme';
8879
return (

0 commit comments

Comments
 (0)
Please sign in to comment.