Question:
I use Effect https://effect.website.
I got it working inside of WIX Frontend and Backend.
After a few weeks of coding along I discovered that if I use Effect the SSR Process does not work somehow.
https://dev.wix.com/docs/velo/api-reference/wix-window-frontend/warmup-data/introduction
When I try to set warm up data using the VELO API the date is only set when I don’t have Effect in my code.
I also wonder if this breaks the entire SSR proccess or not.
Product:
Studio Editor
What are you trying to achieve:
I want to set warmupdate and control the server-side rendering process.
What have you already tried:
Tested different packages and versions, created a POC site to test it without the rest of the stuff I build.
Additional information:
Since the logging in SSR is limited, there is none.
I find it really difficult to debug this scenario.
Example
https://integralsd.wixstudio.com/my-site-14
https://integralsd.wixstudio.com/my-site-14/working
In the example code, I don’t even have to run the effect for the code to break.
If you remove
Effect.gen(function* () {
console.log('Running effect');
yield* Effect.logError('error')
})
Wamrup data works
CODE:
import wixData from 'wix-data';
import wixWindowFrontend from 'wix-window-frontend';
import { Effect } from 'effect';
async function getData() {
if (wixWindowFrontend.rendering.env == "backend") {
console.log("Rendering on the server");
wixWindowFrontend.warmupData.set("data", `Data from SSR`);
}
}
$w.onReady(async function () {
getData()
Effect.gen(function* () {
console.log('Running effect');
yield* Effect.logError('error')
})
const dataResults = wixWindowFrontend.warmupData.get("data");
console.log('RESULLT: ', dataResults);
});