Files
klz-cables.com/.pnpm-store/v10/files/d2/ea62bf44747246f06ec7c1691a6ff2591662382efda7ba2242eaa647de1966becfad4036af0209784c6913963668097727ffabf9404949c6d809c9178c3a5f
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

62 lines
1.9 KiB
Plaintext

'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { useSearchParams as useNextSearchParams } from 'next/navigation.js';
import * as qs from 'qs-esm';
import React, { createContext, use } from 'react';
const initialContext = {
searchParams: {},
stringifyParams: () => ''
};
const Context = /*#__PURE__*/createContext(initialContext);
/**
* @deprecated
* The SearchParamsProvider is deprecated and will be removed in the next major release. Instead, use the `useSearchParams` hook from `next/navigation` directly. See https://github.com/payloadcms/payload/pull/9581.
* @example
* ```tsx
* import { useSearchParams } from 'next/navigation'
* ```
*/
export const SearchParamsProvider = ({
children
}) => {
const nextSearchParams = useNextSearchParams();
const searchString = nextSearchParams.toString();
const searchParams = React.useMemo(() => qs.parse(searchString, {
depth: 10,
ignoreQueryPrefix: true
}), [searchString]);
const stringifyParams = React.useCallback(({
params,
replace = false
}) => {
return qs.stringify({
...(replace ? {} : searchParams),
...params
}, {
addQueryPrefix: true
});
}, [searchParams]);
return /*#__PURE__*/_jsx(Context, {
value: {
searchParams,
stringifyParams
},
children: children
});
};
/**
* @deprecated
* The `useSearchParams` hook is deprecated and will be removed in the next major release. Instead, use the `useSearchParams` hook from `next/navigation` directly. See https://github.com/payloadcms/payload/pull/9581.
* @example
* ```tsx
* import { useSearchParams } from 'next/navigation'
* ```
* If you need to parse the `where` query, you can do so with the `parseSearchParams` utility.
* ```tsx
* import { parseSearchParams } from '@payloadcms/ui'
* const parsedSearchParams = parseSearchParams(searchParams)
* ```
*/
export const useSearchParams = () => use(Context);
//# sourceMappingURL=index.js.map