Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ui): exports parseSearchParams (#10185)
As pointed out in #10164, parsing a `where` query from search params is not exactly straightforward. Internally we rely on the `qs` module for this, but it comes with a couple small nuances that are undocumented, like the need to stringify them and specify depth. To standardize this, we use a `parseSearchParams` utility internally that accepts the `URLSearchParams` object that the `useSearchParams()` hook returns from `next/navigation`. This PR exports that function for reuse and adds JSDocs accordingly. Usage looks something like this: ```tsx 'use client' import { useSearchParams } from 'next/navigation' import { parseSearchParams } from '@payloadcms/ui' function MyComponent() { const searchParams = useSearchParams() const parsedSearchParams = parseSearchParams(searchParams) } ```
- Loading branch information