A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello, I am trying to implement the search filter for the IndexFilter polaris Component.
It is supposed to reload page with the new parameter to pass to the graphql query but the page is not properly loaded.
What is the correct way to implement the search filter?
I put the code in an useEffect when the qeryValue is changed:
useEffect(() => { if (!queryValue) return; const params = new URLSearchParams(window.location.search); params.set('query', queryValue); const newUrl = `${window.location.pathname}?${params.toString()}`; window.history.pushState({}, '', newUrl); window.location.reload(); }, [queryValue]);
I tried with useNavigate too but it doesn't work, I get a Login page.
Hi Antonio,
Can you give a bit more info on your use case - what are you building (eg: admin UI extension) and what error messages / unexpected returns are you seeing?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog