feat: useMenuItems
This commit is contained in:
4
wp-content/themes/headless/shared/utils/graphql.ts
Normal file
4
wp-content/themes/headless/shared/utils/graphql.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Helper: Extracts nodes from a GraphQL connection object, returning an empty array if nodes are absent.
|
||||
export function extractNodes<T>(connection: { nodes?: T[] } | null | undefined): T[] {
|
||||
return connection?.nodes ?? [];
|
||||
}
|
||||
Reference in New Issue
Block a user