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.
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.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()
.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: