I am currently looking at ways to reduce database calls and came upon warmupData. But I don’t seem to understand what ‘backend’ really implies here. Does it mean me being able to use code only in my backend files? (.jsw etc)… or does it mean only the backend rendering done by wix as part of the split in the rendering process… Which means that would be out of my control? I am confused here
The example on documentation is
async function getData() {
const results = await wixData.query("myCollection").find();
if (wixWindow.rendering.env == "backend") {
wixWindow.warmupData.set("myWarmupData", results.items);
wixWindow.warmupData.set("myWarmupMessage", “Rendering in the backend.”);
}
return results;
}
Is there any way to tell when its possibly going to render in the backend so I can plan my code accordingly?
And how do I structure my code to make it help reduce db calls that are redundant? Where exactly to i place the if (wixWindow.rendering.env == “backend”) part? After the query? Before? Or somewhere else
Basically, I have some database calls to fetch some rows from a collection that happens multiple times often yielding the same results. I was expecting this to work like some sort of a cache, unless I don’t understand this correct