WeaverseClient
WeaverseClient loads Weaverse page data, theme settings, and custom page metadata on the server. It also runs registered component loaders and integrates with Hydrogen caching.
Initialization
Create the client in your app load context:Public API
API is the current API version segment ('v1'), not a complete endpoint URL.
Methods
fetchWithCache
Fetch data through Hydrogen’s cache integration:
strategy, not the Fetch API cache property, for Hydrogen cache-control options.
loadThemeSettings
weaverseTheme from the root loader so withWeaverse can initialize theme and translation stores:
response.theme.
loadPage
type
Supported PageType values:
'*''INDEX''PRODUCT''ALL_PRODUCTS''COLLECTION''COLLECTION_LIST''PAGE''BLOG''ARTICLE''CUSTOM'
locale
An optional BCP 47 locale override such as en-US, sv-SE, or fr-CA. The value is forwarded unchanged. When omitted, the request uses context.storefront.i18n; loadPage() does not implement its own URL-prefix detection or en-us fallback.
handle
The resource or custom-page handle used with page types such as PRODUCT, COLLECTION, PAGE, BLOG, and ARTICLE.
projectId
Overrides the client’s resolved project ID for this request. Constructor-level projectId can also be a synchronous or asynchronous function for multi-project storefronts.
strategy
A Hydrogen CachingStrategy, for example:
Example
null indicates that loading or validation failed; do not treat it as a reliable page-not-found signal.
fetchCustomPages
execComponentLoader
loadPage() calls this internally.
generateFallbackPage
Related
- WeaverseHydrogenRoot - Render loader data
- withWeaverse - Initialize root theme and Studio providers
- Data Fetching and Caching - Component data loading