Introduction

To improve performance the rendering process is split in two when possible: once on the server and once in the browser. When that isn't possible, all rendering happens in the browser.

Because rendering can occur twice, it's preferred to perform time-consuming tasks only once, such as querying collections or working with the results of network requests from external sites. If possible, it's best to perform these operations on the server.

Requesting the warmup data from the server returns undefined in the following situations:

  • When browser rendering happens before server-side rendering.
  • When there is only browser rendering, for example in case visitors navigate from page to page within a site.

Your page code must check for these scenarios and provide a fallback alternative for getting the data.

Use the warmupData API and env property of the Rendering API to track when and where your code is running. This lets you selectively run parts of your code.

Notes:

  • Rendering never occurs server-side when previewing your site.
  • Backend rendering only occurs when visitors initially enter the site, and not when visitors navigate from page-to-page within the site.

To use the Warmup Data API, import warmupData from the wix-window-frontend module:

Copy
1
Was this helpful?
Yes
No