- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
Menu
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
useQueryGraphStep - Helper Steps API Reference
This documentation provides a reference to the useQueryGraphStep
step. It belongs to the @medusajs/medusa/core-flows
package.
This step fetches data across modules using the Query.
Learn more in the Query documentation.
Example#
To retrieve a list of records of a data model:
1import {2 createWorkflow3} from "@medusajs/framework/workflows-sdk"4import {5 useQueryGraphStep6} from "@medusajs/medusa/core-flows"7 8const helloWorldWorkflow = createWorkflow(9 "hello-world",10 () => {11 const { data: products } = useQueryGraphStep({12 entity: "product",13 fields: [14 "*",15 "variants.*"16 ]17 })18 }19)
To retrieve a single item instead of a an array:
To throw an error if a record isn't found matching the specified ID:
To set pagination configurations:
Input#
UseQueryGraphStepInput
UseQueryGraphStepInput<TEntry>
UseQueryGraphStepInput
UseQueryGraphStepInput<TEntry>Output#
GraphResultSet
GraphResultSet<TEntry>
GraphResultSet
GraphResultSet<TEntry>Was this page helpful?