Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone
I'm developing an extension that needs to perform some async operations in the paint() function.
From the documentation, I seem to understand that you can return a Promise from the paint() function, so I did something like this (code simplified for the question):
paint: function ($element, layout) {
return new qlik.Promise((resolve, reject) => {
return myAsyncOperation(layout).then(result => {
process(result); //do my rendering
return resolve();
});
});
}
This alternating execution makes it impossible for me to render the extension consistently, since the HTML code is manipulated simultaneously by the two calls, leaving it in an inconsistent state.
Now, I understand why the calls are alternating, that is how promises work... the real question here is: why is the paint() method called three times, and the second and third time in the middle of the execution of the first call? And why does it only happen when I switch from one sheet to the other?
NOTE: I have an empty resize() method, so paint() is not getting called due to resize events.
Hi @master_t do you have any actions on the target sheet which could change something and then trigger the paint method? If you create an empty sheet, this continue to happen?
This looks like a weird behaviour, it would be better to have the Qlik App and extension source code for debugging. Can you share them?
There might be actions on the sheet actually... I'll do some tests on a clean sheet and see if anything changes, thanks.