pissang commented on a change in pull request #13139:
URL: 
https://github.com/apache/incubator-echarts/pull/13139#discussion_r471422952



##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -371,6 +371,13 @@ class DataView extends 
ToolboxFeature<ToolboxDataViewFeatureOption> {
         addEventListener(closeButton, 'click', close);
 
         addEventListener(refreshButton, 'click', function () {
+            if ((typeof contentToOption === 'undefined' && typeof 
optionToContent !== 'undefined') ||
+                (typeof contentToOption !== 'undefined' && typeof 
optionToContent === 'undefined')) {
+                console.warn('It seems you have just provided one of 
`contentToOption` and `optionToContent` functions but missed the other one. 
Data change is ignored.')
+                close();

Review comment:
       Usually warn is only displayed in dev mode.
   
   So a __DEV__ condition should be wrapped here.
   ```ts
   if (__DEV__) {
     console.warn('....');
   }
   ```

##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -371,6 +371,13 @@ class DataView extends 
ToolboxFeature<ToolboxDataViewFeatureOption> {
         addEventListener(closeButton, 'click', close);
 
         addEventListener(refreshButton, 'click', function () {
+            if ((typeof contentToOption === 'undefined' && typeof 
optionToContent !== 'undefined') ||
+                (typeof contentToOption !== 'undefined' && typeof 
optionToContent === 'undefined')) {

Review comment:
       It will be better to use `null` check here
   
   ```
   if (contentToOption == null ...) {}
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to