Setting filter stack doesn't work on initial loading

I've implemented the table filter stack as described here.

If I add console logging at each step it looks like everything goes well, see console output below. IF I wait a while, or click again, it starts working fine, but the initial couple of seconds the output suggests it all goes well but it isn't actually functional.

Console output

Starting initial script, with value X

Set variable

Set current view

Cleaned filter stack

Initial script complete

Success script starting with value X

Success script complete

Filter stack set

Scripts:

Click handler

console.log("Starting initial script, with value", Organizations.selectedRow.OrganizationId);
await selectedOrganizationId.setValue(Organizations.selectedRow.OrganizationId).then(() => console.log("Set variable"));
await MainTabs.setCurrentView("Apps").then(() => console.log("Set current view"));
await Apps.clearFilterStack().then(() => console.log("Cleaned filter stack"));
console.log("Initial script complete")

Success

console.log("Success script starting with value", selectedOrganizationId.value);
Apps.setFilterStack({filters: [{id: 'organizationFilter', columnId: "OrganizationId", operator: '=', value: selectedOrganizationId.value}], operator: "and"}).then(() => console.log("Filter stack set"))
console.log("Success script complete")

Hello @janpieterz,

Thank you for linking the thread for added context and laying out the steps so concisely!

So it sounds like the console logs confirm that the code is running on clickof the container view to start everything.

Then variable is being set with the filter data, the view is being set and the stack is being cleared.

As well as that the success script runs after the initial steps.

Is the issue that visually the table in the container view is not showing the filters after the click event to change the view and that there is some lag/delay in the filter being applied?