Hi Retool Team,
I have a page with the following flow:
- User clicks button
- Button triggers workflow
- Workflow triggers query
- Query triggers the following script:
// Trigger both queries
const outputPromise = outputSummary.trigger();
const inputPromise = inputSummary.trigger();
// Wait for both queries to complete before running updateScenarioAI
Promise.all([outputPromise, inputPromise])
.then(() => {
const currentPage = url.href.split('/').pop();
if (currentPage === "run_simulation") {
// Both queries completed and page is run_simulation, so run updateScenarioAI
updateScenarioAI.trigger();
} else {
console.log("updateScenarioAI not triggered because page is not run_simulation");
}
})
.catch(error => {
// Handle any errors that occurred in either query
console.error("Error occurred:", error);
utils.showNotification({
title: "Error",
description: "Failed to run one or more queries",
type: "error"
});
});
Now, these are AI calls that often take between 15 to 30 seconds. The user already has available data from what the workflow returned, so he may decide to go back to another page and change parameters. However, the two AI queries are still running.
I have set up a js to give the user warning that they are still running and they can decide whether to go ahead and change page or not.
However, if they DO change page, the queries keep running, and then I get the error updateScenarioAI does not exist, have you deleted it or change the name.
I would like to know if:
- It is possible to force queries to stop running, I haven't found a method for this, so I don't think it is possible
- Is it possible to hide this notification somehow? As written above, the query is being triggered from a success event handler which is a script
Thanks!