Onload snippet executing multiple time when opening in popup from different skuid pages table row ac

HI team,

We are opening a skuid page through popup when user clicks on table row action and this page has a on-load snippet. we are facing issue when user click on another records’s row action then this popup is opening but on-load snippet execute 2 times and after closing the popup if again i open any other record then on-load snippet execute 3 times . i am assuming skuid is storing the records opened in popup and execute on-load snippet multiple time. please help me to resolve this issue if suppose i  am opening 100th records from the table’s row action then the on-load snippet will execute 100 times and this will increase processing time.

Thanks
Akanksha

Hi Akanksha, we were wondering if you could resolve the issue in the meantime? If not, could you please share more information and include screenshots?

  1. Which Skuid version is currently installed?
  2. Do you use V1 or V2 pages here?
  3. Do you use a snippet of the type "In-Line" or "In-Line (Snippet)"?
  4. If type "In-Line (Snippet)", how do you trigger the snippet?
  5. Which type of row action(s) do you use to open the popup?
  6. Do you use a PageInclude in the popup to display the other Skuid page?
  7. If not, how did you include the Skuid page in the popup?
  8. How do you observe that it's executed more than once?
Thanks! Luzie & team

Hi Luzie,

Which Skuid version is currently installed?      
11.2.9
Do you use V1 or V2 pages here?
V1
Do you use a snippet of the type “In-Line” or “In-Line (Snippet)”?
“In-Line”
If type “In-Line (Snippet)”, how do you trigger the snippet?
Which type of row action(s) do you use to open the popup?
Table Action Properties
Action Type-Run Multiple action
Action: Show Popup
Do you use a PageInclude in the popup to display the other Skuid page?
Yes
If not, how did you include the Skuid page in the popup?
How do you observe that it’s executed more than once?
Snippet which is execution on poupup has some console.log and so if suppose i am opening 100th records from the table’s row action then the on-load snippet will execute 100 times

Thanks 
Akanksha

Hi Akanksha,

Thank you for the feedback. We created a simplified repro page and tested it in the latest releases of Skuid version 11 and 12. If we set up the test page correctly, we can’t reproduce the issue. Every time I click one record’s row action, the popup opens, the snippet is executed once, and the console log shows the text once. However, we were wondering if you meant that the browser console shows a number before the console log? Please see the screenshot below, this is what we see after we clicked each of the four row action once. The number is the total amount of console logs, that got bigger every time we clicked a row action. The console log happens only once, every time we click a row action. If we cleared the console after we every time clicked a row action, you wouldn’t see the number growing. I understand that this is expected behaviour. Does this behave the same way if you test it? I’ll add the XML of the two pages we tested, please add those as new pages to your org and test it as well. Please let us know if your test scenario looks different, and also please add a screenshot of your browser console.

Main page:

Step 1: Open browser console NewModel

XML for Page in Page Include:

LuzieTestSnippetOnLoadPage2, check console for "SkuidConsoleLogTest"

(function(skuid){ var $ = skuid.$; $(document.body).one('pageload',function(){ console.log("SkuidConsoleLogTest") }); })(skuid);

Hi Luzie,

thanks for your reply,

I am not able to save your main page XML but i found one difference which may be the reason for this issue,

in the inline snippet on our popup page, we are using below syntax to call this onload snippet every time instead of one time,

In my code:
$(document.body).on(‘pageload’,function(){

In your code
$(document.body).one(‘pageload’,function(){

Thanks,
Akanksha Singh

Thank you for the feedback Akanksha! We recommend to use “.one” :slight_smile:

You can find more information in our online documentation, it would be even better to use event-triggered sequences:
https://docs.skuid.com/latest/en/skuid/javascript/skuid-javascript.html#do-not-use-jquery-s-ready-event-to-determine-if-a-page-is-loaded

“If your Skuid version supports it, strongly consider using event-triggered action sequences. Creating a sequence triggered by the Skuid Page: Rendered event, with the Run A Skuid Javascript Snippet action activating a snippet will accomplish the same effect in a less error-prone, more future-proof manner.”