Skip to content

Commit

Permalink
fix(merge): fix onChange props. (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 19, 2023
1 parent 162a191 commit 6708e6e
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions merge/src/Internal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,20 @@ export const Internal = React.forwardRef((props: CodeMirrorMergeProps, ref?: Rea
if (otherStore.collapseUnchanged !== collapseUnchanged) {
opts.collapseUnchanged = collapseUnchanged;
}
if (Object.keys(opts).length && dispatch && original && modified && editor.current) {
if (Object.keys(opts).length && dispatch) {
dispatch({ ...opts });
}
if (original && modified && editor.current) {
view.destroy();
const viewDefault = new MergeView({
a: original,
b: modified,
new MergeView({
a: { ...original },
b: { ...modified },
parent: editor.current,
...opts,
});
dispatch({ ...opts, renderRevertControl, view: viewDefault });
}
}
}, [
view,
original,
modified,
editor,
orientation,
revertControls,
highlightChanges,
gutter,
collapseUnchanged,
renderRevertControl,
]);
}, [view, original, modified, editor, orientation, revertControls, highlightChanges, gutter, collapseUnchanged]);

const defaultClassNames = 'cm-merge-theme';
return (
Expand Down

0 comments on commit 6708e6e

Please sign in to comment.