T
TanStack•3mo ago
exotic-emerald

Search mask not working on initial load

I'm finding that if I try to use navigate or even redirect on my initial URL to mask search params, it does not work. E.g. in https://codesandbox.io/p/devbox/stoic-cerf-qj7jyh You can see that there is a navigate in a useEffect:
useEffect(() => {
console.log("NAVIGATING INITIAL");
navigate({ to: ".", search: (p) => p, mask: { to: ".", search: {} } });
}, []);
useEffect(() => {
console.log("NAVIGATING INITIAL");
navigate({ to: ".", search: (p) => p, mask: { to: ".", search: {} } });
}, []);
This preserves the search params in the URL, but does not seem to do any masking, which I am trying to use to hide the search params in the URL. Even the devtools is not picking it up any masking. On subsequent navigations, masking does work.
4 Replies
exotic-emerald
exotic-emeraldOP•3mo ago
ok so if i add a proper "to", it works. e.g. navigate({ to: "/about", search: (p) => p, mask: { to: ".", search: {} } }); ok so it seems like the problem actually is it fails to mask if the to matches the current route. E.g. if I load it on /random?someQueryParams=ABC and do navigate({ to: "/random", search: (p) => p, mask: { to: "/random", search: {} } }); the mask will fail to apply hey @Manuel Schiller just wondering if you had some idea on what was going on here 🙂 sorry for the tag - not sure how to get attention to these question posts if no one dropped into them? Happy to know what you guys prefer instead!
correct-apricot
correct-apricot•3mo ago
sorry not so deep into location masking do we have GitHub issues for those?
exotic-emerald
exotic-emeraldOP•3mo ago
no. I'll make one. is it usually better when they are created beforehand?
correct-apricot
correct-apricot•3mo ago
before what? it's a good idea to track bugs in GitHub so we don't forget about them discord is not the best place for reporting bugs

Did you find this page helpful?