-
Notifications
You must be signed in to change notification settings - Fork 399
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
Submission values not accessible through action object #251
Comments
@aoberoi I feel like I'm doing something really stupid here. Any chance you could verify this? Pasting the example from the Slack example docs still results in an error: |
@SpencerKaiser have you been able to receive standard, block-level actions (ones that don't have a callback id) in these newer releases of bolt? I've been banging my head against the wall all day and still couldn't get my app to receive the events. I see the POST request coming to the server, but it's almost like bolt is swallowing the action. I never even see a simple console.log() message I added in the listener. |
@shauntarves I had all sorts of issues setting it up, but here are my biggest tips:
If none of that works, post back here and I’ll take a look at what I did |
@SpencerKaiser Thank you for your help. Point 3 from above was my issue - I wasn't using the dictionary object. |
@SpencerKaiser I wasn't able to reproduce this and didn't need to type cast the Did your steps in #251 (comment) resolve your issues? If not, I can help try to troubleshoot what's happening, but the construction of your method looks correct to me. |
@shanedewael Those steps were mostly just general debugging around receiving an event via an action, so they don't help with this issue. Just retested after running Error from compiler:
Is there something I'm doing wrong there? |
Sorry, I had something wrong with the types that I was getting in VSCode and I'm able to reproduce this now. For now, the workaround you highlighted works or I prefer using generics:
In the future, one solution may be moving |
I did something similar in my actual implementation: const { submission } = action as DialogSubmitAction; Without the typecasting there I get an error... |
(I forgot to add the actual generic. I updated the code now 😅) |
Haha no worries! Just updated my workaround in the issue description. |
Same comment as with #252. I feel like a change to the docs should be made before this is closed. |
sorry for jumping in so late, I have a few thoughts to add. @SpencerKaiser if you're using TypeScript for your project, i def recommend using the generic parameter as @shanedewael and you figured out. however, there's still a way to do this from just JavaScript or when you don't want to specify a generic parameter. Example below (once again cribbed from the docs):
the difference is just adding @shanedewael I think we should make this adjustment in the docs. what do you think? |
Description
After receiving a submission event, the
submission
object is inaccessible on theaction
object.What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Bug Report
When trying to access content from a dialog submission, both the
action
andbody
objects don't provide an accessor for thesubmission
values.Steps to reproduce:
submission
valuesExpected result:
Values are accessible
Actual result:
Values are inaccessible and requires casting
action
to a{[key: string]: any}
object, which makes linters angry.Property 'submission' does not exist on type 'ButtonAction | UsersSelectAction | StaticSelectAction | ConversationsSelectAction | ChannelsSelectAction | ExternalSelectAction | OverflowAction | DatepickerAction | ButtonClick | MenuSelect | DialogSubmitAction | MessageAction'.
Workaround
By using the generic in your signature, you're able to access
submission
(credit to @shanedewael)The text was updated successfully, but these errors were encountered: