Next.js Discord

Discord Forum
Any help would be much appreciated! 🙇","dateCreated":"2023-09-14T13:41:36.000Z","answerCount":0,"author":{"@type":"Person","name":"Pink salmon"}}}

Remove query params in getServerSideProps from url, but still pass data to component via props.

Unanswered
Pink salmon posted this in #help-forum
Open in Discord
Pink salmonOP
Is there a way inside a pages getServerSideProps function to remove the query params from the url but still pass data into the page component props?

I can see at the bottom of the pages html that the props are being passed in a script tag, which makes sense how the component values are populated. But that means we don't need the query params in the url (and I don't want to muddy the url with all that data).

<script id="__NEXT_DATA__" type="application/json">
            {"props":{"pageProps":{"title":"technicalDifficulties","message":"tryAgain","ctaText":"reloadPage","ctaLink":null,"serviceErrorCode":"500"},"__N_SSP":true},"page":"/error","query":{"title":"technicalDifficulties","message":"tryAgain","ctaText":"reloadPage","serviceErrorCode":"500"},"buildId":"development","isFallback":false,"gssp":true,"scriptLoader":[]}
</script>


Any help would be much appreciated! 🙇

0 Replies