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

Hash usage isn't described in the docs #100

Open
seregap opened this issue May 16, 2024 · 2 comments
Open

Hash usage isn't described in the docs #100

seregap opened this issue May 16, 2024 · 2 comments

Comments

@seregap
Copy link

seregap commented May 16, 2024

Is there a way of describing or using a hash? There is no mention of it in either the documentation or the examples.

This could be as follows:

$path({
route: "/product/[productID]",
routeParams: { productID: 23 },
searchParams: { userInfo: { name: "bob", age: 23 } },
hash: "some-hash",
})

// this generates the following string:
// "/product/23?userInfo=%7B%22name%22%3A%22bob%22%2C%22age%22%3A23%7D#some-hash"

@ethanniser
Copy link
Owner

ha this has never come up before
but definitely has a use case, I agree with your proposal, an additional optional string prop to $path

prs welcome

@bring-shrubbery
Copy link
Contributor

Worth mentioning that hash is not passed to the server side by default, so it can only be used in client side hooks. This separation between server/client is quite a bit of a headache in this case.

@seregap I'd say you're better off just using $path({ ... }) + `#some-hash`.

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

3 participants