async ajax call to an activity or datapage blocks the requestor
We have a data page that needs to be pinged from the browser, simply to pre-fetch data that we know will be needed later on.
We notice that if the datapage takes extra time to process, that the user is then prevented from moving along in the flow.
We would like this to not be the case.
Steps to Reproduce
make request for a requestor level datapage or activity using an async ajax call in js.
Then try to move onto the next page in the flow. Notice that the longer the datapage or activity takes, the longer you will have to wait for the next page in the flow to appear.
***Edited by Moderator Marissa to update SR Details; update platform capability tags***
We don't have direct way to fire a request and forget the response, all the ajax requests will be waited at server side to get completed. One option in Pega to achieve is to have an Embedded Section (dummy section) dropped using the page context as the "Use Data Page" option and configure the "Defer Load" by checking the checkbox. This will help in loading the page asynchronously when the page is rendered and does not block the actions being performed.
Would it be possible to get an explanation or code sample of what the Defer Load is actually doing under the hood. If a section can spawn off asynchronous processing, then it should be possible to achieve the same with a simple ajax call.
I don't have the answers to your ajax design questions, but could you possibly create an innocuous section that you could reload and call an activity that asynchrously loads your data page? That should be fairly light weight, and assuming there is enough time between when you call it and when you need it, sounds like it would meet your needs.
Regarding your comment "Would it be possible to get an explanation or code sample of what the Defer Load is actually doing under the hood. If a section can spawn off asynchronous processing, then it should be possible to achieve the same with a simple ajax call. "
Be aware that the more you rely on under-the-hood features of the UI Engine, the more likely things will break when that undocumented and unsupported feature is modified by Pega, either via a hotfix, or just new development. I see client issues all the time that preface with "this used to work in the previous release....."
If Mike's suggestion works, then I strongly advise you to use it. It stays within the guardrails and is not tightly coupled to how the internals currently work.
Are you using Pega JS API getDataPage to load the dataPage? If yes, can you test the same by not setting a callback function in the options parameter of getDataPage function?
Ajax is asynchronous by default. Anyways, adding Load-DataPage in an activity is asynchronous. So even if the ajax is synchronous in this case, the activity with a Load-Datapage shouldn't take long to finish.