Skip to content
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

View closes straight after view.update #1123

Closed
4 tasks done
viperfx opened this issue Sep 22, 2021 · 3 comments
Closed
4 tasks done

View closes straight after view.update #1123

viperfx opened this issue Sep 22, 2021 · 3 comments
Labels
question M-T: User needs support to use the project

Comments

@viperfx
Copy link

viperfx commented Sep 22, 2021

Description

Describe your issue here.

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

  • bug

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

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • 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: 3.6.0

node version: 14

OS version(s): Windows Gitbash

Steps to reproduce:

  1. Use message shortcut to open a view
  2. Use submit button to update the view
  3. The view shows success message and stays open. User closes it with "Close" button.

Expected result:

The updated view should stay open.

Actual result:

we are finding that when we use the client.views.update call - our updated view closes straight after being updated.

We are using the the docs outlined here - https://slack.dev/bolt-js/concepts#updating-pushing-views

We have tried to call ack right at the start or right after the view.update call - neither make a difference.

We noticed this behaviour upgrading from the legacy slack SDK to Bolt SDK

@seratch seratch added the question M-T: User needs support to use the project label Sep 22, 2021
@seratch
Copy link
Member

seratch commented Sep 22, 2021

Hi @viperfx, thanks for taking the time to write in and sharing the code example (that was so helpful to understand your question)!

This might be a bit confusing but to update a modal in response to view_submission requests (= the request handled by @app.view listeners), you can use ack() method with response_action instead of a views.update API call:

If your app just received a view_submission payload, you have 3 seconds to respond, and update the source view. Respond to the HTTP request app with a response_action field of value update, along with a newly composed view.
https://api.slack.com/surfaces/modals/using#updating_response

For reference, this example app may be helpful for learning how to use it in a real situation.

app.view("modal-callback-id", async ({ ack, body }) => {
  await ack({
    response_action: "update",
    view: buildNewModalView(body),
  });
});

I found that this bolt-js document section should have a clear explanation about this. We'll update the part shortly.

I hope this helps!

@viperfx
Copy link
Author

viperfx commented Sep 22, 2021

Thanks for the quick reply! Couple of questions - is the view_id required? and what the hash for race conditions?

Update: The suggested solution works and solves the issue. Feel free to close this.

@seratch
Copy link
Member

seratch commented Sep 22, 2021

@viperfx Thanks for your prompt reply and I'm glad to hear that you've figured out the way! Let us close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

2 participants