Skip to content

Prepend base in goto #11803

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

Open
benmccann opened this issue Feb 6, 2024 · 3 comments
Open

Prepend base in goto #11803

benmccann opened this issue Feb 6, 2024 · 3 comments
Milestone

Comments

@benmccann
Copy link
Member

Describe the problem

sveltejs/eslint-plugin-svelte#679

Describe the proposed solution

Maybe can we improve interface of goto.
For example goto considers basepath automatically if base is set in config file.

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

@PatrickG
Copy link
Member

PatrickG commented Feb 6, 2024

This would need to be configurable, since resolveRoute() already adds the base path.

@codenoid
Copy link
Contributor

as long it's optional, I'm fine

@marekdedic
Copy link

Hi, seeing as this is based on a lint rule I wrote, let me add a bit of context and push back on the optionality part. If I understand things correctly, goto should only ever be used for internal navigation - so for navigating to pages that (by definition) start with the base path. In that case, it seems to me that prepending the base path is always the correct option.

I haven't really used resolveRoute so I probably don't know all its uses, but it seems to me to be just a helper you use when constructing addresses for goto (and/or pushState and replaceState?). So it would make sense for resolveRoute to not prepend the base path and leave that to goto.

Relatedly, shouldn't pushState and replaceState prepend the base path as well? It seems to me that they are also intended to only be used for internal navigation (of course, passing an empty string to them would be handled as a special case...)

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

No branches or pull requests

4 participants