pinecone-router / router

The extensible client-side router for Alpine.js v3
https://pinecone-example.vercel.app/
MIT License
228 stars 7 forks source link

Question:Support for Nested Routing in Pinecone Router #41

Open fankaiLiu opened 4 weeks ago

fankaiLiu commented 4 weeks ago

Is your feature request related to a problem? Please describe. I'm currently developing an application using Alpine.js and Pinecone Router. My project requires nested routing to manage UI structures, but I can't find support for nested routes in Pinecone Router. Describe the solution you'd like I would like Pinecone Router to support nested routing, allowing for more structured and hierarchical URL paths. This feature should enable defining child routes within parent routes directly.

Describe alternatives you've considered As an alternative, I've considered manually handling route dependencies.

Additional context Nested routing is crucial for applications that have multiple layers of components and need to maintain clean and organized URL structures. This feature would greatly enhance the usability of Pinecone Router for more complex applications.

rehhouari commented 4 weeks ago

Hey thanks for the suggestion! To answer, no it doesn't support nested routing currently. I didn't plan this feature though I see how it is crucial in certain situations. I'm not sure how would I implement this in code, I'll try to think it over but I can't guarentee I will ship as I am busy with some other stuff. O

You said you considered manually handling dependencies, I guess that is tedious and not very organized. does using multiple reusable handlers help? as in adding a profileHandler to all routes under the /profile path, including whichever handler they need?

Sorry for the inconvenience, hope you figure it out in the meanwhile. You might also want to look at alternatives, currently I only know of only one other Alpine.js router which is this: https://github.com/shaunlee/alpinejs-router, one difference is that it have RegEx route matching, which maybe would help you?

fankaiLiu commented 4 weeks ago

Hey thanks for the suggestion! To answer, no it doesn't support nested routing currently. I didn't plan this feature though I see how it is crucial in certain situations. I'm not sure how would I implement this in code, I'll try to think it over but I can't guarentee I will ship as I am busy with some other stuff. O

You said you considered manually handling dependencies, I guess that is tedious and not very organized. does using multiple reusable handlers help? as in adding a profileHandler to all routes under the /profile path, including whichever handler they need?

Sorry for the inconvenience, hope you figure it out in the meanwhile. You might also want to look at alternatives, currently I only know of only one other Alpine.js router which is this: https://github.com/shaunlee/alpinejs-router, one difference is that it have RegEx route matching, which maybe would help you?

Thanks for the prompt reply, Pinecone is a very good routing library.

Currently I'm using x-handle ,unified processing in

document.getElementById(templateTargetId) 

is null according to certain rules to request the corresponding template, then

document.getElementById(currentTargetId). innerHTML 

prepopulates the template.

I'm mostly a backend developer so I don't have a lot of good suggestions, maybe support nested definitions when defining routes?

I'll continue to use Pinecone, he's working great, thanks again for your contribution!