Optimize Page Rendering with Warmup Data

Use warmup data to speed up your site's page rendering by reducing the number of data operations that occur during client-side rendering.

Follow this procedure to make a data query that is called only once during server-side rendering. The query results are sent as warmup data for display during client-side rendering. If the data query was not made during server-side rendering, it is called for the first time during client-side rendering.

  1. Add your import statements.
Copy
  1. Define a getData() function that makes a wixData query. Use warmupData.set to conditionally set the query results as warmup data if the query is being made during server-side rendering.
Copy
  1. In your onReady() code, store your data in a variable called dataResults. Retrieve the warmup data by calling warmupData.get. If server-side rendering does not occur, dataResults should default to the return value of getData().
Copy

In this example, the dataResults variable is populated with the results of the query in all cases. When possible, we have optimized performance by using the warmup data initially fetched on the server, instead of running the query a second time during client-side rendering.

The full page code looks like this:

Copy

See also

Was this helpful?
Yes
No