Ver Fonte

HUE-8752: [editor] Variable substitution does not use the default value when empty (#814)

Mykhailo Kysliuk há 6 anos atrás
pai
commit
8a1469e
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      desktop/core/src/desktop/js/apps/notebook/snippet.js

+ 3 - 1
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -949,9 +949,11 @@ class Snippet {
             const pad =
               variable.type() == 'datetime-local' && variable.value().length == 16 ? ':00' : ''; // Chrome drops the seconds from the timestamp when it's at 0 second.
             const value = variable.value();
+            const isValuePresent = //If value is string there is a need to check whether it is empty
+              typeof value === 'string' ? value : value !== undefined && value !== null;
             return (
               p1 +
-              (value !== undefined && value !== null
+              (isValuePresent
                 ? value + pad
                 : variable.meta.placeholder && variable.meta.placeholder())
             );