Skip to content

Commit

Permalink
Merge pull request #13139 from easonyq/fix-13031
Browse files Browse the repository at this point in the history
Fix: make `contentToOption` totally optional
  • Loading branch information
pissang authored Aug 26, 2020
2 parents ed19857 + 13ae2d4 commit 6af8923
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/component/toolbox/feature/DataView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,15 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
addEventListener(closeButton, 'click', close);

addEventListener(refreshButton, 'click', function () {
if ((contentToOption == null && optionToContent != null) ||
(contentToOption != null && optionToContent == null)) {
if (__DEV__) {
console.warn('It seems you have just provided one of `contentToOption` and `optionToContent` functions but missed the other one. Data change is ignored.')
}
close();
return;
}

let newOption;
try {
if (typeof contentToOption === 'function') {
Expand Down

0 comments on commit 6af8923

Please sign in to comment.