kobweb icon indicating copy to clipboard operation
kobweb copied to clipboard

parameterized pages

Open gabe97330 opened this issue 3 years ago • 3 comments

Seems useful to have a "generator" page composable that stands in for a set of similar page composable functions rather than a composable for each. Something in the spirit of parameterized tests in Junit5?

gabe97330 avatar Jan 14 '22 12:01 gabe97330

Can you give me a concrete use case of what you're trying to accomplish from your site's user's point of view? (Want to make sure dynamic routes or query parameters could not satisfy the problem.)

On Fri, Jan 14, 2022, 4:12 AM Gabe Beged-Dov @.***> wrote:

Seems useful to have a "generator" page composable that stands in for a set of similar page composable functions rather than a composable for each. Something in the spirit of parameterized tests in Junit5 https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests ?

— Reply to this email directly, view it on GitHub https://github.com/varabyte/kobweb/issues/96, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNONASI5WSQF52D5WEJUELUWAHJPANCNFSM5L6USFUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

bitspittle avatar Jan 14 '22 15:01 bitspittle

Dynamic routes seem equivalent to parameterized pages from a site user's perspective and honestly, I overlooked their significance . Parameterized pages could be interesting from a early binding time perspective e.g. for static export but are definitely not necessary.

gabe97330 avatar Jan 14 '22 16:01 gabe97330

It is true that dynamic routes are excluded from exports while parameterized pages wouldn't be.

By the way, it's less convenient but you can also declare multiple Page annotations and have them all delegate to the same underlying composable which could work in a pinch.

I'm definitely going to leave this suggestion open but I'm hesitating on expanding the API for now just to keep the surface area I need to maintain a little smaller until I can better understand more use cases.

That being said, if you or anyone thinks of them, please share them here anytime. I'm absolutely open to reprioritizing.

On Fri, Jan 14, 2022, 8:34 AM Gabe Beged-Dov @.***> wrote:

Dynamic routes seem equivalent to parameterized pages from a site user's perspective and honestly, I overlooked their significance . Parameterized pages could be interesting from a early binding time perspective e.g. for static export but are definitely not necessary.

— Reply to this email directly, view it on GitHub https://github.com/varabyte/kobweb/issues/96#issuecomment-1013277074, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKNONAWDWHPIWH4V5UNRDELUWBGBJANCNFSM5L6USFUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

bitspittle avatar Jan 14 '22 16:01 bitspittle

I know this issue is crazy old and, if you're like me, you might even be looking at it now and barely remembering anything about it.

But I thought I'd ping it since I'm adding a new feature to Kobweb soon, which lets you explicitly add routes to get exported. This might be useful for creating specific instances of dynamic routes.

So for example, you can do this (in v0.15.3 whenever that goes out in the next few days):

kobweb {
   app {
     export {
       addExtraRoute("/users/0/posts/0", "posts/default-post.html")
   }
}

Between this and dynamic routes, I think we could probably do anything you originally intended with parameterized pages, so after 0.15.3 goes out, I'll probably close this old issue at long last :)

bitspittle avatar Dec 04 '23 18:12 bitspittle

0.15.3 is out!

bitspittle avatar Dec 12 '23 22:12 bitspittle