set( )

Sets data in server-side code for use in client-side code.


A performance best practice is to set warmup data for time-consuming operations, such as querying collections or working with the results of network requests from external sites. You can write code that sets the data from these operations as warmup data on the server. The client-side code can then get that data without performing the operations again.

You can only set warmupData on the server. This function has no effect if called from client-side code.


  • Rendering never occurs server-side when previewing your site.
  • wix-window.warmupData replaces the deprecated wix-window.rendering.warmupData.
  • Server-side rendering only occurs when visitors initially enter the site, and not when visitors navigate from page-to-page within the site.



This endpoint does not take any parameters

Status/Error Codes

Was this helpful?

Set the warmup data on the server

Copy Code
1import wixWindow from 'wix-window';
5if (wixWindow.rendering.env === "backend") {
6 wixWindow.warmupData.set("myWarmupMessage", "Now rendering on the server.");
Use warmup data to send already-retrieved query results from the server to the client-side

This example demonstrates how to use warmupData to optimize performance between server-side and browser rendering.

The example has a getData() function that performs a query on a MyCollection collection.

If this operation happens to run on the server, the results are set for later browser use. The wixWindow.rendering.env property indicates if the run is occurring on the server (backend) or on the client-side (browser).

When rendering in the browser, the client-side code checks if the query results already exist. If so, there is no need to perform the same query again. If not, the client-side code runs the query.

Two text boxes are defined on the page: retrievedMessage displays a message about where the rendering occurred and retrievedData displays the query items.

Copy Code
1import wixData from 'wix-data';
2import wixWindow from 'wix-window';
4async 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 on the server.");
10 }
11 return results;
14$w.onReady(async function () {
15 const defaultMessage = "Rendering client-side."
16 const dataResults = wixWindow.warmupData.get("myWarmupData") || await getData();
17 const message = wixWindow.warmupData.get("myWarmupMessage") || defaultMessage;
18 $w("#retrievedData").text = JSON.stringify(dataResults);
19 $w("#retrievedMessage").text = message;