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

Documentation: $params helper examples #251

Open
gianmarco27 opened this issue Jul 11, 2022 · 11 comments
Open

Documentation: $params helper examples #251

gianmarco27 opened this issue Jul 11, 2022 · 11 comments
Assignees

Comments

@gianmarco27
Copy link

Current examples provided in the documentation are a bit misleading as they rapresent a usage of the $params helper function that does not follow the default implementation, it is specified below that by default the native URLSearchParams function is used, i believe it would be helpful and clearer, either to adapt the examples to the actual default usage, or add the custom function used to obtain such result, and highlight better that the default behaviour would be different from the one displayed in the example.

P.S. Awesome tool! keep it up :)

@jakobrosenberg
Copy link
Member

Thanks for spotting this. It seems there's something missing in the description.

@jakobrosenberg jakobrosenberg self-assigned this Jul 14, 2022
@jakobrosenberg
Copy link
Member

IIRC the behavior is the same as described here.
https://v3.ci.routify.dev/docs#guide/introduction/parameters

@gianmarco27
Copy link
Author

Yes, in the V3 documentation this is made way clearer! :)

@gianmarco27
Copy link
Author

Thing to be noted tho, during my tests i tryed a usage like "/subfolder/page/:id", while having a fallback page configured at root level in my folder structure, and instead of hitting the "/subfolder/page" with param { page: id }, it was going straight to the root level fallback.

It only worked as intended when i configured it to use only URLSearchParams

@jakobrosenberg
Copy link
Member

That sounds like a bug. Can you create a minimal reproducible?

@gianmarco27
Copy link
Author

gianmarco27 commented Jul 25, 2022

So i tryed to go back and reproduce the behaviour i stated above, but it turns out i was missing the Syntactical sugar section of the V3 documentation, where i should name my destination file wrapped in [ ] to have it work as a path parameter.
No bug in here, just a problem between the chair and the screen.
Thank you for your patience, i hope my feedback can help you make V2 documentation clearer for future use.

@gianmarco27
Copy link
Author

gianmarco27 commented Jul 26, 2022

I'm not sure this is the right channel, but since i'm in the topic and it could potentially be a new issue, i'm going to introduce it here.
Should it be possible to use path parameters like "/subfolder/page/:id" together with named routes in a $goto helper?
$goto('tools.show', {tool: id}) with file named [tool].svelte

From what i'm testing now, it correctly writes the intended path in the browser history, but routify appears to be routing me back to the "/subfolder/index", by visiting the same url via the $url helper inside a link, or with the "back" browser button i reach correctly the intended page

@jakobrosenberg
Copy link
Member

@gianmarco27 I'm not sure I follow. Could you give me a step by step of what you're doing, what's happening and what you're expecting?

@gianmarco27
Copy link
Author

gianmarco27 commented Jul 27, 2022

Upon a form submission, i'm trying to redirect to a success page which should contain the submitted informations.
So i have setup a $goto on success to the page which is named like [id].svelte.
this page contains <!-- routify:options name="tools.show" -->
and i'm calling $goto('tools.show', {id: slug_number})

I would expect to be redirect to such page on success, what happens instead is i get navigated to such page, and then redirect to the same-level index.svelte file.
if i browse back with the "back" arrow from the browser i land on the [id].svelte page correctly at the url foldername/slug_number.
I tryed creating a reproducible to show you from the starter template but i am unable to reproduce the same ux flow.
I should investigate further my project to understand what is causing the double navigation.

is this type of usage $goto('tools.show', {id: slug_number}) supposed to work and route me to foldername/slug_number?
Thank you for your time

@jakobrosenberg
Copy link
Member

I would have expected that to work. Are you using Routify 2?

@gianmarco27
Copy link
Author

Yes i'm using 2.18.8
After all turns out it was again a problem on my side.
After the $goto call, more code from the originating page was still being executed causing the weird behaviour

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