Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
raisch opened this issue Dec 21, 2022 · 0 comments
Open

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

raisch opened this issue Dec 21, 2022 · 0 comments

Comments

@raisch
Copy link
Contributor

raisch commented Dec 21, 2022

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);
            }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant