Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

../ not working with Link component #1917

Open
spazzymoto opened this issue Jul 12, 2024 · 1 comment
Open

../ not working with Link component #1917

spazzymoto opened this issue Jul 12, 2024 · 1 comment

Comments

@spazzymoto
Copy link

Version:

  • @inertiajs/vue3 version: 1.2.0

Describe the problem:

We are attempting to use inertia js with vue3 for our backend application but ran into some issues using the link component. We would like to be able to use relative URLs but are running into some issues using ../ to go one level in the URL back. The Link component stays on the same URL

Steps to reproduce:

If we have the following URL

http://localhost/path1/path2/path3

And on the Vue page I have the following links

<Link href="../">One level up</Link>
<a href="../">One level up</a>

The inertia link is pointing to http://localhost/path1/path2/path3
The a tag is pointing to http://localhost/path1/path2

I suspect it is cause the vue3 link component is calling mergeDataIntoQueryString which is making a new URL with 'http://localhost' as the base so it can never go one path level up from that. I suspect changing that to use window.location.toString() like hrefToUrl does would solve the issue? If you agree I am happy to open a PR with the changes?

const url = new URL(href.toString(), 'http://localhost')

@Verox001
Copy link

First off I have to ask if you're using Laravel as your backend, if so that wouldn't even be supported at Laravel's end. And it would be interesting to know if the ../ in your route works, when manually inersting it into your URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants