question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Links that ignore basePath?

See original GitHub issue

Thank you for creating Raviger, it is really close to the routing lib I was considering making out of frustrations with the existing ones! I really like the “cascading routes” concept that allows me to extract, say, a tab-bar and its contents into a component and have it not care about which base route it sits on.

That said, there are times where I want to ignore the basePath and link to something outside the scope of the closest useRoutes context. I am currently solving that with relative links that go through parents (i.e. ../../account), but that is now another way of coupling the specific path to my component. I tried overriding basePath with '/', '' and null which doesn’t work (strips away the hostname and everything, or does nothing). Am I missing something fundamental, or should we consider adding an isAbsolute or similar property to Link?

EDIT: I should add that I am happy to make a PR for this if you agree.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kristiandupontcommented, Sep 29, 2021

https://codesandbox.io/s/loving-joliot-0lvb8?file=/src/App.js

If you click on the “Deep Root” link, and then on the “About” link under that, you will see the DeepAbout component render two links to contact, one that is inside the deep root (which is correct), and one that attempts to link to the outer contact url. The second one is broken.

0reactions
kyeoticcommented, Oct 7, 2021

@kristiandupont Running the repro you provided if you go to filters and play with the stuff there you will see query strings that dont cause routing to fail, and no wildcard is used for that route.

Think you might have another issue for 1️⃣

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to obtain a path without using Link when basePath is set ...
Reason being, that '../' is the relative path, but I may move this page to a new location, or even share the code...
Read more >
Use next/link as to change the url along with baseurl #18851
On using , next appends the domain+basepath and url becomes : abc.com/test/final where test is not intended in the url... pages directory structure...
Read more >
Base Path - next.config.js
Links. When linking to other pages using next/link and next/router the basePath will be automatically applied. For example, using /about will automatically ...
Read more >
API Host and Base Path - Swagger
REST APIs have a base URL to which the endpoint paths are appended. The base URL is defined by schemes , host and...
Read more >
Next.js and GitHub Pages, how the basePath and assetPrefix ...
All the links are directed at / rather than your repository subpath. The page has no styling, the CSS is pointing to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found