T
TanStack13mo ago
other-emerald

Parse search params "manually"?

I have implemented a Data Table component that can save filters. Filters are saved on the server as a string that is the page's search params. Example: channelId=%5B%22Azure_Test%22%2C%22BMQ_Test%22%5D&sortBy=channelId&sortOrder=asc. When I load this filter, I want to do the same operation that TanStack Router does to create the equivalent JSON object (channelId as a string array, sortBy as string, etc). How do I do that?
1 Reply
other-emerald
other-emeraldOP13mo ago
I eventually figured it out
import { defaultParseSearch } from '@tanstack/react-router';

defaultParseSearch(filterString)
import { defaultParseSearch } from '@tanstack/react-router';

defaultParseSearch(filterString)

Did you find this page helpful?