Skip to content

Error if requestConfig.args are given via function #44

@kenwenzel

Description

@kenwenzel

I use

requestConfig: {
    endpoint: window.location.origin + "/sparql",
    args: (yasqe) => {
        return [{ name: "model", value: $('#model').val() }];
    }
}

to dynamically set the argument model before executing a query.

When a new tab is created the error

Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.

occurs due to the following line:

if (Array.isArray(objValue) || Array.isArray(srcValue)) {

The exception occurs because srcValue is the value returned by the above args function while objValue is the function itself.
Maybe the checks must be combined by && instead of ||?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions