#Search mask not working on initial load

10 messages · Page 1 of 1 (latest)

pulsar zenith
#

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: {} } });
  }, []);

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.

pulsar zenith
#

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

pulsar zenith
#

hey @low heron 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!

low heron
#

sorry not so deep into location masking

#

do we have GitHub issues for those?

pulsar zenith
#

no. I'll make one. is it usually better when they are created beforehand?

low heron
#

before what?

#

it's a good idea to track bugs in GitHub so we don't forget about them