The CacheNone() strategy instructs caches not to store any data. The function accepts no arguments. Learn more about [data fetching in Hydrogen](/docs/custom-storefronts/hydrogen/data-fetching/fetch-data).
import {json} from '@shopify/remix-oxygen';
import {CacheNone} from '@shopify/hydrogen';
export async function loader({context}) {
const data = await context.storefront.query(
`#grahpql
{
shop {
name
description
}
}`,
{
cache: CacheNone(),
},
);
return json(data);
}
import {json, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
import {CacheNone} from '@shopify/hydrogen';
export async function loader({context}: LoaderFunctionArgs) {
const data = await context.storefront.query(
`#grahpql
{
shop {
name
description
}
}`,
{
cache: CacheNone(),
},
);
return json(data);
}
export function CacheNone(): NoStoreStrategy { return { mode: NO_STORE, }; }