Next.js Discord

Discord Forum

Route does hard-reload instead of soft reload when passing in URL-encoded "{"

Unanswered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
I'm trying to do an experiment with NextJS SSR, using the app directory.

I have a client component that is changing the URL, with something like:

router.push(
            (window.location.pathname || '/') +
              encodeURIComponent('{blah}'))


This seems to do a hard refresh in the browser. If I remove the braces (to just blah), then it does a soft reload.

I'm ultimately trying to store some JS state in the URL, but this is a bit of a blocker. Any ideas?

0 Replies