FYI, for the warmupData stuff…either the docs are wrong, or the API is broken. The docs show the following example:
(note line 8 in bold)
async function getData() {
5 const results = await wixData.query("MyCollection")
6 .find();
7 if (wixWindow.rendering.env == "backend") {
8 wixWindow.warmupData.set("myWarmupData", results.items);
9 wixWindow.warmupData.set("myWarmupMessage", "Rendering in the backend.");
10 }
11 return results;
12}
This code does not compile. Apparently, the set method takes two strings as parameters. (string key, string data). result.items is not a string, so I get the red squiggly with the message:
Argument of type ‘any[]’ is not assignable to parameter of type ‘string’.
I’m guessing you have to JSON.stringify the set and then JSON.parse the get. But it would be great if either the docs or the API could be fixed.
Thanks