T
TanStack13mo ago
conscious-sapphire

How to correctly account for space character in search params

Hello, When I use this code to navigate to a page with given search params, it puts "foo+bar" in to the url. Then, when I click back it navigates to "foo%20bar" with the correct encoding for the space character. Am I using navigate incorrectly? How can I make it correctly encode the space? Thanks
navigate({
to: `/search`,
search: { query: "foo bar" },
})
navigate({
to: `/search`,
search: { query: "foo bar" },
})
2 Replies
passive-yellow
passive-yellow13mo ago
a complete minimal example would be helpful to debug this. can you please create one by forking one of the examples on stackblitz?
conscious-sapphire
conscious-sapphireOP13mo ago
@Manuel Schiller It appears someone just forgot to invoke preventDefault on a form submission that was calling navigate. So, it was encoding correctly then the form submission would break it. Thanks for replying!

Did you find this page helpful?