-
Notifications
You must be signed in to change notification settings - Fork 393
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
Bug: Adding block elements through code make actions disable #2138
Comments
Could you please provide some code to reproduce the issue? |
@filmaj Please check the code and video
Screen.Recording.2024-06-20.at.5.20.10.PM.movScreen.Recording.2024-06-20.at.5.20.48.PM.mov |
@bilalashraf1710 what is the value of |
Related (or maybe separate issue): the callback to your first view submission seems odd: it is trying to update two modals, the current modal (view_1) as well as a "thinking modal". That is not possible, as there can only be 1 modal shown to the user at a time. That may be why you are seeing the odd "flashing" UI that your video displays. If I modify your app.view('view_1_callback', async ({ ack, body, view, client, logger }) => {
const modal = { // <-- in your code snippet above, this object was not being used
type: "modal",
callback_id: "view_2_callback",
external_id: "123",
title: { type: "plain_text", text: "View 2" },
submit: { type: "plain_text", text: "Let's Go" },
blocks: [
{
type: "input",
block_id: "rich_text_block",
label: {
type: "plain_text",
text: "Refined Text",
},
element: {
type: "rich_text_input",
action_id: "rich_text_input_action",
initial_value: {
type: "rich_text",
elements: view.state.values?.rich_text_block?.rich_text_input_action?.rich_text_value?.elements,
},
},
},
],
}
await ack({ response_action: "update", view: modal }) // <--- in this code snippet, the new modal is now being used
// await client.views.update({ external_id: thinkingModal.external_id, view: modal }) // <--- this should not work, as only a single modal can be viewed at a time. I commented this out in my example. |
@filmaj I intentionally added that thinking modal because view-1 rich-text sharing the same context with view-2 rich-text. In my case, I do some DB calls while showing the Thinking modal to the user. |
The following code worked fine for me (I used a app.command('/post', async ({ ack, say, body, client, logger }) => {
await ack();
await client.views.open({
trigger_id: body.trigger_id,
view: {
type: "modal",
callback_id: "view_1_callback",
title: { type: "plain_text", text: "View 1" },
submit: { type: "plain_text", text: "Let's Go" },
blocks: [
{
type: "input",
block_id: "rich_text_block",
label: {
type: "plain_text",
text: "Refined Text",
},
element: {
type: "rich_text_input",
action_id: "rich_text_input_action",
},
},
],
},
})
});
app.view('view_1_callback', async ({ ack, body, view, client, logger }) => {
const thinkingModal = {
type: "modal",
callback_id: "thinking",
external_id: "thinking",
title: { type: "plain_text", text: "Thinking!!!" },
blocks: [
{
type: "section",
text: {
type: "plain_text",
text: "Processing, please wait",
}
}
]
}
const modal = {
type: "modal",
callback_id: "view_2_callback",
external_id: "123",
title: { type: "plain_text", text: "View 2" },
submit: { type: "plain_text", text: "Let's Go" },
blocks: [
{
type: "input",
block_id: "rich_text_block",
label: {
type: "plain_text",
text: "Refined Text",
},
element: {
type: "rich_text_input",
action_id: "rich_text_input_action",
initial_value: {
type: "rich_text",
elements: view.state.values?.rich_text_block?.rich_text_input_action?.rich_text_value?.elements,
},
},
},
],
}
await ack({ response_action: "update", view: thinkingModal })
await new Promise((res) => setTimeout(res, 5000)); // wait for 5 seconds
await client.views.update({ external_id: thinkingModal.external_id, view: modal })
}); Here's a gif of the code in action: Make sure you use unique |
@filmaj when you navigate to view-2. Can you please press the Lets Go button and see if it works? The issue is Let's Go button was not working until you edit the message on view-2. if you have any other button that would not work too |
Hmm I see what you mean. Indeed, if there's a user mention in the rich text input and you go to submit it again, there is an error. There is a need to slightly modify the text payload in order for it to submit: Interestingly, it seems to me like this is an error from the Slack client itself, as the submit of view 2 errors out on the client side. Thank you for your patience working with me through this. I think I see the problem, too. If you open the Slack client devtools (it is just like a browser!), when you go to submit the view 2 modal the first time, here is the payload sent to the underlying Slack API state: {"values":{"rich_text_block":{"rich_text_input_action":{"type":"rich_text_input","rich_text_value":{"type":"rich_text","elements":[{"type":"rich_text_section","elements":[{"type":"text","text":"hi "},{"type":"user","userId":"U05T59XL1E3"}]}]}}}}} The error returned by this API is: {
"ok": false,
"error": "invalid_arguments",
"response_metadata": {
"messages": [
"[ERROR] failed to match any allowed schemas [json-pointer:\/state\/values\/rich_text_block\/rich_text_input_action\/rich_text_value]",
"[ERROR] missing required field: user_id [json-pointer:\/state\/values\/rich_text_block\/rich_text_input_action\/rich_text_value\/elements\/0\/elements\/1]"
]
}
} Note: the view payload does not include If you then change the contents of the rich text input, it works! And the payload to the state: {"values":{"rich_text_block":{"rich_text_input_action":{"type":"rich_text_input","rich_text_value":{"type":"rich_text","elements":[{"type":"rich_text_section","elements":[{"type":"text","text":"h "},{"type":"user","user_id":"U05T59XL1E3"}]}]}}}}} Correct Thanks for reporting this. I will raise this internally. |
Hmm Interesting. When I print the elements on view-2 then it show user_id in a correct way. |
Hi Slack Team and @filmaj 👋 |
No update here unfortunately. I recommend sending an email to feedback@slack.com and link to this issue and explain how it is a blocker for you - that will help prioritize the work to fix this. |
Thanks, I'll keep you updated 🤞 |
Hey @alessio-ragni, I'm also hitting this bug. Did you ever submit a customer report or hear about a fix? |
I also opened a ticket but unfortunately they also replied without an ETA
:( and AFAIK there is no workaround. I hope they will fix soon.
…On Wed, 21 Aug 2024 at 19:22, Stephen ***@***.***> wrote:
Hey @alessio-ragni <https://github.com/alessio-ragni>, I'm also hitting
this bug. Did you ever submit a customer report or hear about a fix?
—
Reply to this email directly, view it on GitHub
<#2138 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAN2FQEO45EAILMLPOCX23ZSTEF3AVCNFSM6AAAAABJSHQPPWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBSGU4TQMJTGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi Slack team 👋 |
Hello everyone! The fix for this issue is now rolled out to all Slack workspaces and plans. I just tested this and everything works as desired! Going to close this issue down but feel free to comment or open a new one if you still have issues. |
(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)
@slack/bolt
version^3.17.1
Your
App
and Receiver ConfigurationNode.js runtime version
20.12.2
Steps to reproduce:
(Share the commands to run, source code, and project settings)
I am fetching Slack blocks through code and sending them to GPT to refine the messages. The refined blocks are well-formatted and work fine with Block Kit. However, when the blocks contain user_id elements within a rich-text box, buttons on the screen become unresponsive. Interestingly, if I manually edit the rich-text block by adding a space, the buttons start working. Could you please help refine this?
Expected result:
Buttons should work fine without editing the message
Actual result:
Buttons are not working and I can see the warning icon's next to button and submit button also not working.
The text was updated successfully, but these errors were encountered: