Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.
This repository was archived by the owner on May 27, 2021. It is now read-only.

Using a YAQL templating string instead of a list causes the entire web UI to crash #386

Description

@miyoyo

Currently, when passing something such as:

  notify_user:
    action: msexchange.send_email
    input:
      log_level: DEBUG
      body: "<% ctx().email_body %>"
      subject: "<% ctx().subject %>"
      to_recipients: <% ctx().to_recipients %>

Where to_recipients expects a list, even if the YAQL query returns a list, react fails to render and the screen goes permanently white until a full page reload.

The error happens here:

return v ? v.join(', ') : '';

image

The exact error is
image

From what I understand, the method just does not expect that v could be a bad string.

A quick fix would be to do a type check before attempting to return a value.

  toStateValue(v) {
    if (jsonCheck(v)) {
      return JSON.stringify(v);
    }

    if (isJinja(v)) {
      return v;
    }

    const { secret } = this.props.spec || {};
    if (secret && v && !Array.isArray(v)) {
      return v;
    }

    if(v == null) {
        return '';
    }

    if(!Array.isArray(v)) {
      // "Invalid Value"
    }

    return v.join(', ');
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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