I am developing a plugin where there are multiple object views. Each view contains an html content inside it.
Consider there are 3 object views.
View 1 has API call 1 , view 2 has API call 2 and view 3 has API call 3.
If I navigate to all 3 views and then press refresh , then in browser console, I see all API calls happening 3 time.
(i.e) API call 1 , 2 and 3 is happening 3 times.
The number of times call happens is equivalent to the number of object views/html content inside each view.
Is there any fix for this ?
Below is a sample extension view I added.
I am using SDK 6.0.0
My understanding is that this is expected behavior. Global refresh really reloads everything including the whole inventory tree and all views.
As you have opened all your 3 views they had been cached and then refreshed even though not all of them are displayed. Without this you would get stale data when the user switches back to your cached views which is not desirable plugin behavior.
If you need special handling you should add it to your own global refresh handler.
Thanks for the response, what you explained is the behavior I am expecting , but in my case , each API in all pages gets called multiple time .
I was able to come up with a solution for my problem.
Just added a flag based check on my refresh handler. When user clicks on global refresh , the flag is checked and only if it is true , then I make the API call and changes flag to false .
On success of the API I make the flag true. So any successive API calls will be blocked till the API is successful. This has fixed the issue I was facing.