Stop Link Component from calling the server?
Answered
Spectacled Caiman posted this in #help-forum
Spectacled CaimanOP
I am trying to copy this setup in my app.
https://www.youtube.com/watch?v=ukpgxEemXsk
I have a Link to ?r=/settings which is used to show the settings menu inside my video player, but it's also sending a request back to my server, can i disable it from calling my server?
https://www.youtube.com/watch?v=ukpgxEemXsk
I have a Link to ?r=/settings which is used to show the settings menu inside my video player, but it's also sending a request back to my server, can i disable it from calling my server?
Answered by joulev
12 Replies
@Spectacled Caiman I am trying to copy this setup in my app.
https://www.youtube.com/watch?v=ukpgxEemXsk
I have a Link to ?r=/settings which is used to show the settings menu inside my video player, but it's also sending a request back to my server, can i disable it from calling my server?
Looks like prefetching. Try <Link prefetch={false}>
Spectacled CaimanOP
i disabled prefetching already, problem is that it will make a request when i click on it
@Spectacled Caiman i disabled prefetching already, problem is that it will make a request when i click on it
So you want to change the url search params entirely client side and not sending anything to the server?
Aka shallow routing?
Spectacled CaimanOP
yeah
i am using it to store what page my video player menu is on
like this
the captions would have ?r=/settings/captions
Spectacled CaimanOP
updated to next@canary and using window.history.pushState works, thanks!
@Spectacled Caiman updated to next@canary and using window.history.pushState works, thanks!
Btw it was in canary 2 months ago so by now I think it’s in stable already, very likely it already works in 14.0.4
Spectacled CaimanOP
oh yeah it is in stable, thanks for telling me