Skip to main content

Function: useMenu()

useMenu(options): UseMenuReturn

Defined in: composables/react/useMenu.ts:127

useMenu — category-tree fetch with a depth-configurable recursive GraphQL query.

Parameters

options

UseMenuOptions

see UseMenuOptions.

Returns

UseMenuReturn

the category tree, loading/error state and fetch/cache actions — see UseMenuReturn.

Remarks

GraphQL integration: unlike the SDK-service hooks, fetchMenu runs a raw query directly via graphqlClient.query() — it builds a recursive categories { ... } fragment to the configured depth and reads the root category's children. Results are cached in localStorage with a 12h TTL under a key scoped by root category, language and userKey. A module-level inflightFetches map dedups concurrent fetches for the same key so a second caller awaits the first and reads from cache. The category query is public and needs no authenticated session.