Hi group!
I can't get this to reliable work.
I have a Google Workspace Add-on, that uses the HTML service and sidebar for functionality that requires polling.
I need to make sure that the add on is reloaded when the sidebar is closed, is there a way to do it that always works?
This is the flow: openSidebar_() -> resetNavigation_() -> HTML -> closeSidebar() -> resetNavigation_()
// Apps Script
function openSidebar_() {
SpreadsheetApp.getUi().showSidebar(...);
return resetNavigation_();
}
// Apps Script
function resetNavigation_() {
const card = buildMainCard();
const nav = CardService.newNavigation()
.popToRoot()
.updateCard(card);
return CardService.newActionResponseBuilder()
.setStateChanged(true)
.setNavigation(nav)
.build();
}
// HTML Template
google.script.run
.withSuccessHandler(() => google.script.host.close())
.withFailureHandler(() => google.script.host.close())
.closeSidebar();
// Apps Script
function closeSidebar() {
return resetNavigation_();
}