@@ -187,17 +187,16 @@ define([
187187 OperationControl . prototype . addAttribute = function ( opId , name , value ) {
188188 var type = 'string' ;
189189
190- // Set the defaultValue
191190 if ( value === undefined ) {
192191 value = null ;
193- }
194- type = typeof value ;
192+ } else { // determine the attribute type
193+ type = typeof value ;
195194
196- // Figure out the type
197- if ( type === 'number' ) {
198- type = parseInt ( value ) === value ? 'integer' : 'float' ;
195+ // Figure out the type
196+ if ( type === 'number' ) {
197+ type = parseInt ( value ) === value ? 'integer' : 'float' ;
198+ }
199199 }
200-
201200 this . _client . setAttributeMeta ( opId , name , { type : type } ) ;
202201 this . _client . setAttribute ( opId , name , value ) ;
203202 } ;
@@ -208,8 +207,13 @@ define([
208207 } ;
209208
210209 OperationControl . prototype . setAttributeDefault = function ( opId , name , value ) {
211- this . removeAttribute ( opId , name ) ;
212- this . addAttribute ( opId , name , value ) ;
210+ if ( value ) {
211+ this . removeAttribute ( opId , name ) ;
212+ this . addAttribute ( opId , name , value ) ;
213+ } else { // just remove the default
214+ value = value !== undefined ? value : null ;
215+ this . _client . setAttribute ( opId , name , value ) ;
216+ }
213217 } ;
214218
215219 OperationControl . prototype . updateCode = function ( fn , nodeId ) {
0 commit comments