Forum Academy Marketplace Showcase Pricing Features

How to access a nested list of objects in the plugin code without making an external API call?

Also, while the .reduce() solution is clever, you don’t have to do it that way. (But as I say at some point you just have to accept that you’re at the end of your levels and, if there’s still Things there, you just .get(‘_id’) on them and that’s that.)

1 Like

@keith Thank for your help.

You can’t call .get(‘_id’) on a string that represent the thing ID. I don’t have the same object referencing itself. Could you give the recipe for .reduce() 3 levels deeper?

I am getting the error .get is not a function

Right. That’s basically what I’ve been saying. Keep going until you have the levels you need.

I’m AFK right now, but I was playing with this earlier, obviously, because it’s interesting and I was working on a callback function for the reducer that could support some arbitrary number of levels but then I had to go to brunch.

I’ll get back to it sometime soon, but it’s just not that hard to work out. (You could do this by recursion in the reducer function, or you could do it with less sexy code and just walk the original list to n levels of children using a for loop.)

1 Like

@keith Thank you in advance. Lot of people might interested about your solution . Even the for loop is good for me. Just need something that works.

This is the recusive (barely tested) version that keith recommended not using. However, if you know that your data structure does not contain any infinite loop scenarios it could be of use. It’s also possible to store certain values (e.g. uid) to detect recursion, but I didn’t feel that to be a necessary exercise here.

function reReduce(obj, prop) {
        var res = obj.get(prop);
        if(res && res.hasOwnProperty('get')) {
            return res.listProperties().reduce((object, property) => ( object[property] = reReduce(res,property) , object ), {});  
        else {
            return res;
var result =, => item.listProperties().reduce((object, property) => ( object[property] = reReduce(item,property) , object ), {}));


Thank you. We fixed the issue but this solution can’t be used in production due to the performance issue. It takes around 20-30 sec the first time the plugin is called and then it goes down to 500 ms in average.

Here is what Bubble supports said "I understand this is critical to your app’s success. I’ve communicated with our Engineering team to see if they can shed any light on your question, and they stated that we delete any function after it’s dormant for some time, so recreating it takes some time. Generally your example of AWS fits here as well; any time a request is made for the first time in a while there needs to be some time for the server to “warm up.”

We are going to create a cron job to keep our plugin alive to avoid the “warm up” the first time. We hope it will work.

Host the code on aws or google cloud and your warmup time will be negligible

Te cron job call did the trick. We used 5 min interval and it works perfectly. No more warm up period.

1 Like

Dope solution even if slightly convoluted. I used to do the same with a free heroku api I had built at one point.

Take care of your endpoints. Keep them alive when it’s important!

1 Like