Skip to content

[BUG] Unable to update string param using nodeParams dialog. #101

@raisch

Description

@raisch

Background

Added a new 'key' param with a blank string as its default.

    'OutPort': {
        ins: [{ name: 'amp', default: 1 }],
        outs: ['out'],
        params: [{ name: 'key', default: '' }],
        state: [],
        description: 'one out, with transport key',
    }

Expected Behavior

When opening the node params dialog and entering a string for the "key" param, the value of the param would be updated in the audio node.

Actual Behavior

Attempts to update the "key" param with "mix" caused the following error message to appear at the bottom of the dialog key must be a string, not a number and the following exception was displayed in the browser console:

RangeError: key must be a string, not a number
    at Module.validateParams (model.js:775:23)
    at UINode.saveParams (editor.js:1233:23)

Possible Fix

Add conditional test for string param, as in:

            input.oninput = function (evt)
            {
                if (input.value == 'null')
                    newParams[param.name] = null;
                // ==== START OF ADDITION
                else if (typeof param.default === 'string')
                    newParams[param.name] = input.value ;
                // ==== END OF ADDITION
                else
                    newParams[param.name] = Number(input.value);
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions