Bolt-js: `initial_options` should accept empty array

Created on 23 Apr 2020  路  2Comments  路  Source: slackapi/bolt-js

Description

initial_options on action type multi_*_select and checkboxes should accept empty array [] as value, when no option needs to be displayed as checked or selected.
Right now, only option is to not send the key inside element object.

What type of issue is this? (place an x in one of the [ ])

  • [ ] bug
  • [X] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [X] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [X] I've read and agree to the Code of Conduct.
  • [X] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: 2.0.0

node version: 12.13.1

OS version(s): Mac 10.13.6

Steps to reproduce:

  1. Try to send empty array to initial_options key in element object of type multi_*_select or checkboxes

Expected result:

Error thrown:
{
ok: false,
error: 'invalid_arguments',
response_metadata: {
messages: [
'[ERROR] must be one of the provided options [json-pointer:view/blocks/3/elements/0/initial_options]'
],
scopes: [ 'chat:write', 'commands', 'im:history' ]
}
}

Actual result:

It should accept

Attachments:

Screen Shot 2020-04-23 at 4 20 03 AM

discussion question

All 2 comments

馃憢 Thank you for taking the time to write in!

I do understand your frustration here ... but it is a requirement by the server-side. This SDK basically never modifies your payload internally. So, having a logic to check the size of initially selected values plus skipping the field if the size is zero is necessary at this point. I would appreciate your understanding.

Closing this issue due to inactivity. Feel free to comment if you have any further concerns!

Was this page helpful?
0 / 5 - 0 ratings