Ir para o conteúdo
decodecodeveloper docs
Storefront → Blocks → Arquivo de referência Fresh

Fresh archive: Loaders

Sending only necessary data to the client

Documentação de produto descontinuado — Fresh e o antigo admin foram descontinuados. Estas instruções são mantidas para migração e referência histórica. Novos projetos usam Blocks 7.x e o Editor de Sites do Studio.
Esta página ainda não foi traduzida para o português — o conteúdo abaixo está em inglês.

Retired Fresh / Deno reference. This original guide preserves the earlier runtime APIs, Preact/HTMX examples, and any former admin steps. Use it when maintaining that runtime; consult the Studio Site Editor guides for current editing. Migration notes distinguish editor and framework migration.

Summary

Loaders are mechanisms for data loading. There are some tips on how to optimize their usage. Here are some tips:

  1. When the loader is reused in different sections or pages, it is recommended to use a saved loader (reusable)
  2. Sections that load data and are not displayed on the initial screen (above the fold) can be deferred

Reusing Loaders

The system's sections can have data loaded via loaders. These loaders can be defined within the section itself or loaded from saved entities.

These saved entities can be created from loader blocks.

Creating a loader

When saving a loader, it is guaranteed to be reusable in different sections. In addition to allowing props to be changed and reflected in all places where this loader is used, using this saved loader allows for optimizing the system's usage.

During a page like the Product Description Page (PDP), it is necessary to load information about the product twice: once for SEO details loading and once for displaying the product itself. By using the same loader, Deco optimizes it so that the loader is executed only once during the page rendering cycle.

image

Deferred Section

image