bolt-js: Views.update upon static select action not updating modal
Description
Hello,
I’ve been working with Slack support via email and was directed here to check into my issue.
I have a modal with several static selects (1 for each day of the week) and depending on which option the user selects, it will update and populate the modal with more static selects. My issue is that sometimes when the user is selecting an option, it will not correctly update the modal. It acknowledges the request, no error is thrown, and it just stays the same. If you go on to the next day it will often “push through” the correct blocks with the next views.update call. The biggest headache is that this issue is intermittent. It doesn’t happen always but frequently enough to cause regular issues for users.
I’ve tried to alter my code in several ways and still haven’t found the issue.
** I should note I did find issue #1080 but it was closed without a solution. I’ve done much of everything suggested but to no avail. 😦
Any help is much appreciated!
What type of issue is this? (place an x
in one of the [ ]
)
- [ x] bug
- enhancement (feature request)
- question
- documentation related
- example code 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: Bolt 3.12.1
node version: v18.2.0
OS version(s): MacOS Montery 12.2.1
Steps to reproduce:
- Select an option with a static select.
- If the view updates, good. If not,
- Select another option or continue to the next day
- If the next select was used and it updates, it will push both updates (current block and previous unupdated block)
Expected result:
I expect that the modal will update on each action of the first static select. There should appear either 1 more static select, or 3, depending on which option is first selected.
Actual result:
Intermittently the view will not show any updates. The method is called and the blocks pushed are correct. It just doesn’t actually show any update to the modal.
Attachments:
Here’s a code snippet which receives the static select action and based on the selection it updates the modal with the blocks it creates.
if(inCheck === 'in') {
let plt = payload.selected_option.text.text;
let plv = payload.selected_option.value;
if(payload.selected_option.value === 'Banked Time') {
//Pop off all blocks except the start time block (first element)
editingBlock.elements = [];
//Add additional elements to the block to be updated
editingBlock.elements.push(inBlock(dayNum, plt, plv), bankedHours, workedBlock, workedHours); //these elements are premade with options depending on selected option
//Fix the header photo; remove and re-add to clear extra fields
oldView.blocks.shift();
oldView.blocks.unshift(bB.image(appImages.payrollMenu, 'FL Logo'))
return oldView;
//Update view with the new elements pushed into the block
}
else if(payload.selected_option.value === 'Personal (Paid)' || payload.selected_option.value === 'Annual Leave') { //test selected option for a time off type and if so, update the block with additional static selects
//Pop off all blocks except the start time block (first element)
editingBlock.elements = [];
//Add additional elements to the block to be updated
editingBlock.elements.push(inBlock(dayNum, plt, plv), ptoHours, workedBlock, workedHours); //these elements are premade with options depending on selected option
//Fix the header photo; remove and re-add to clear extra fields
oldView.blocks.shift();
oldView.blocks.unshift(bB.image(appImages.payrollMenu, 'FL Logo'))
return oldView;
//Update view with the new elements pushed into the block
//await updateViewAction(client, body, bB.modal(oldView.callback_id, oldView.private_metadata, oldView.title.text, oldView.submit.text, oldView.close.text, oldView.blocks), oldView.hash);
} else if (payload.selected_option.value === 'Off') {
//Pop off all blocks except the start time block (first element)
while(editingBlock.elements.length > 1) {
editingBlock.elements.pop();
};
//Fix the header photo; remove and re-add to clear extra fields
oldView.blocks.shift();
oldView.blocks.unshift(bB.image(appImages.payrollMenu, 'FL Logo'))
return oldView;
//Update view with the new elements pushed into the block
//await updateViewAction(client, body, bB.modal(oldView.callback_id, oldView.private_metadata, oldView.title.text, oldView.submit.text, oldView.close.text, oldView.blocks), oldView.hash);
} else if (payload.selected_option.value === 'Stat') {
//Pop off all blocks except the start time block (first element)
editingBlock.elements = [];
//Add additional elements to the block to be updated
editingBlock.elements.push(inBlock(dayNum, plt, plv), ptoSpecial, workedBlock, workedHours);
//Fix the header photo; remove and re-add
oldView.blocks.shift();
oldView.blocks.unshift(bB.image(appImages.payrollMenu, 'FL Logo'))
return oldView;
//Update view
//await updateViewAction(client, body, bB.modal(oldView.callback_id, oldView.private_metadata, oldView.title.text, oldView.submit.text, oldView.close.text, oldView.blocks), oldView.hash);
} else if (payload.selected_option.value === 'Bereavement' || payload.selected_option.value === 'Cultural Leave Day') {
//Pop off all blocks except the start time block (first element)
editingBlock.elements = [];
//Add additional elements to the block to be updated
editingBlock.elements.push(inBlock(dayNum, plt, plv), ptoSpecial);
//Fix the header photo; remove and re-add
oldView.blocks.shift();
oldView.blocks.unshift(bB.image(appImages.payrollMenu, 'FL Logo'))
return oldView;
//Update view
//await updateViewAction(client, body, bB.modal(oldView.callback_id, oldView.private_metadata, oldView.title.text, oldView.submit.text, oldView.close.text, oldView.blocks), oldView.hash)
} else if (payload.selected_option.value === 'Personal (Unpaid)') {
//Pop off all blocks except the start time block (first element)
editingBlock.elements = [];
//Add additional elements to the block to be updated
editingBlock.elements.push(inBlock(dayNum, plt, plv), unpaidBlock, workedBlock, workedHours);
//Fix the header photo; remove and re-add
oldView.blocks.shift();
oldView.blocks.unshift(bB.image(appImages.payrollMenu, 'FL Logo'))
return oldView;
//Update view
//await updateViewAction(client, body, bB.modal(oldView.callback_id, oldView.private_metadata, oldView.title.text, oldView.submit.text, oldView.close.text, oldView.blocks), oldView.hash)
} else {
//Pop off all blocks except the start time block (first element)
editingBlock.elements = [];
//Add additional elements to the block to be updated
editingBlock.elements.push(inBlock(dayNum, plt, plv), afternoonBlock);
//Fix the header photo; remove and re-add
oldView.blocks.shift();
oldView.blocks.unshift(bB.image(appImages.payrollMenu, 'FL Logo'))
return oldView;
//Update view
//await updateViewAction(client, body, bB.modal(oldView.callback_id, oldView.private_metadata, oldView.title.text, oldView.submit.text, oldView.close.text, oldView.blocks), oldView.hash);
}
}
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (7 by maintainers)
Excellent news! It’s entirely custom to our workspace so I can imagine it was a pain to get running but I very much appreciate your effort!
Just commenting to keep this active. Still having this issue. I’ve noticed it gets progressively worse the more static selects I fill in the modal. The first couple works fine but then they get more and more prone to not updating as users continue to fill in the selects.