Deduplicate Loaders

Finds and consolidates duplicate loaders across page JSONs to reduce redundant API calls.

decocms ba6c031 1.3 KB Updated

File contents

The main point is to reduce the number of API calls to the server.

At the JSON of the pages, you will see loaders defined.

When two equal loaders are defined, you can combine them into a single loader.

Start analyzing the JSON of the page that the user is editing.

If there is no current, page, look for home, categories and search page.

Avoid looping, ask how many pages the user wants to analyze.

Before: "page": { "__resolveType": "vtex/loaders/intelligentSearch/productListingPage.ts", "selectedFacets": [ { "key": "productClusterIds", "value": "334" } ], "count": 24 }, "seo": { "__resolveType": "vtex/loaders/intelligentSearch/productListingPage.ts", "selectedFacets": [ { "key": "productClusterIds", "value": "334" } ], "count": 24 }

After: New file: GlobalCluster334.json { "__resolveType": "vtex/loaders/intelligentSearch/productListingPage.ts", "selectedFacets": [ { "key": "productClusterIds", "value": "334" } ], "count": 24 } "page": { "__resolveType": "GlobalCluster334", }, "seo": { "__resolveType": "GlobalCluster334", }

decocms/storefront-skills/tree/main/.claude-deco/skills/deduplicate-loaders commit ba6c031ce6

Frequently asked questions

npx skillmds@latest add decocms/deduplicate-loaders