-
Notifications
You must be signed in to change notification settings - Fork 395
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
Slack Block Builder do not update static select value in modal #2184
Comments
Hi @mister-good-deal, thanks for asking the question! Indeed, this can be unintuitive, but when you set FYI, here is a simple working example demonstrating what I said above: import { App, BlockAction } from "@slack/bolt";
export function registerListeners(app: App) {
app.event("message", async ({ say }) => {
await say({
text: "hi!",
blocks: [
{
type: "actions",
elements: [
{
type: "button",
action_id: "test",
text: { type: "plain_text", text: "Click Me" },
value: "click_me_123",
},
],
},
],
});
});
app.action<BlockAction>("test", async ({ body, client, ack }) => {
await ack();
await client.views.open({
trigger_id: body.trigger_id,
view: {
type: "modal",
callback_id: "assistantConfigurationModalCallback",
title: { type: "plain_text", text: "AI Assistant" },
blocks: [
{
label: { type: "plain_text", text: "Create or edit Assistant" },
element: {
placeholder: { type: "plain_text", text: "Select assistant" },
options: [
{
text: {
type: "plain_text",
text: "Create new assistant",
},
value: "-1",
},
{
text: { type: "plain_text", text: "mistral-test" },
value: "1",
},
],
action_id: "select_assistant_action",
type: "static_select",
},
dispatch_action: true,
block_id: "select_assistant_action_block_id",
type: "input",
},
],
},
});
});
app.action<BlockAction>(
"select_assistant_action",
async ({ ack, client, body }) => {
await ack();
if (body.view) {
await client.views.update({
view_id: body.view.id,
view: {
type: "modal",
callback_id: "assistantConfigurationModalCallback",
title: { type: "plain_text", text: "AI Assistant" },
blocks: [
{
label: { type: "plain_text", text: "Create or edit Assistant" },
element: {
placeholder: { type: "plain_text", text: "Select assistant" },
options: [
{
text: {
type: "plain_text",
text: "Create new assistant",
},
value: "-1",
},
{
text: { type: "plain_text", text: "mistral-test" },
value: "1",
},
],
// No need to set the initial_option again
// initial_option: {
// text: { type: "plain_text", text: "mistral-test" },
// value: "1",
// },
action_id: "select_assistant_action",
type: "static_select",
},
dispatch_action: true,
block_id: "select_assistant_action_block_id",
type: "input",
},
],
},
});
}
}
);
} |
Ok that's clear, so what is the way to load an initial value from an input which is interactive (ie have Is there an event I can send programmatically to set an input and trigger its |
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized. |
I rephrase it, how to load previously saved data in a modal when it opens? |
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized. |
As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number. |
On
"@slack/bolt": "^3.19.0"
, I got a strange bug where astatic_select
element from Block Builder do not display theinitial_option
correctly in my Slack app.I'm using
"slack-block-builder": "^2.8.0"
to generate the JSON output that updates the following Modal view.It is displaying fine on Slack builder kit preview in https://app.slack.com/block-kit-builder.
But in my Slack app, the initial option
open-mistral-nemo
in theModel
static select input is displaying the 1st elementopen-mistral-7b
instead.Others static selects or multi static selects display initial options fine.
My workflow is :
client.views.update
to update the view like in the following functionThat is really strange as the block kit builder is displaying the initial option correctly...
The text was updated successfully, but these errors were encountered: