PipedreamHQ / PipedreamHQ/pipedream

[BUG] Custom value on "type[]" prop with options does not evaluate to array

Open
#4,931 1 comment 0 reactions 0 assignees View on GitHub
bug tracked internally triaged
Dominant language
JavaScript
Stars
11.7k
Forks
5.8k
Avg merge
3d 10h
Merged PRs (30d)
102

Description

**Describe the bug**
A prop typed `string[]` is properly recognized as an array, both by the standard UI and by the "custom value" methods of assigning a value.
![image](https://user-images.githubusercontent.com/48412907/206919069-162adb33-e925-4028-94f6-22a97abf67f1.png)
![image](https://user-images.githubusercontent.com/48412907/206919114-e77a7cd2-216c-4259-a9ba-6258b8df342e.png)

However, if the prop has options for the user to select, the UI displays checkboxes (i.e. the user can select one or more, since the value is an array), but the "custom value" is treated as `string` instead of `string[]` (array).
![image](https://user-images.githubusercontent.com/48412907/206919313-401db27d-d501-4392-af42-18a5bef5ec8c.png)
![image](https://user-images.githubusercontent.com/48412907/206919326-cc82d709-ab24-45e9-87e8-a17f7f14ae8f.png)

And whatever custom value is passed is indeed received as a string by the action when running it. which will break the action in many cases (if processing the prop with array methods such as `map` or `join`).

**To Reproduce**
After some digging, I've found a Dropbox action that can reproduce this easily, and you can create a Dropbox account within a minute, from the authentication pop-up itself, if you do not have one.

1. Create a workflow with the Dropbox action 'Search files and folders'
2. Add the 'File categories' optional prop. Since this is a `string[]` prop with `options`, the situation above can be reproduced
3. If you enter a custom value, it will be parsed as a string, and the action will fail to run:
![image](https://user-images.githubusercontent.com/48412907/206919898-6d9d5374-587e-4f9d-8591-09863ef16627.png)

**Expected behavior**
Custom values should be parsed as arrays in props that are typed as arrays, even if they have an options selection - which is possibly determining the current behavior without checking for the array case.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.