| |
| ▲ | yawaramin 3 days ago | parent | next [-] | | > D*'s authors are pretty adamant that this is an anti-pattern The Datastar authors are wrong about this. History push is a very important part of the hypermedia-driven application approach. Because URLs are super important. And we want to make sure that the correct URL is shown for the currently-loaded view, and that the view is reproducible given the URL (as much as possible) so that bookmarking and copy-pasting to send URLs just works as expected. A really nice article came out about this just recently: https://alfy.blog/2025/10/31/your-url-is-your-state.html I also wrote a bit more about it here: https://dev.to/yawaramin/why-hx-boost-is-actually-the-most-i... | | |
| ▲ | nchmy 3 days ago | parent [-] | | Thanks very much for a thoughtful reply and link to your article. I look forward to reading it. As it turns out, I shared that very same article in the Datastar discord the other day! Here's some other good ones that I found while digging into the topic, for anyone who cares. * https://warpspire.com/posts/url-design/ * https://blog.jim-nielsen.com/2023/examples-of-great-urls/ * https://www.w3.org/Provider/Style/URI * https://www.hanselman.com/blog/urls-are-ui I strongly agree that good urls are very important. But I don't see how D* prevents correct urls/history at all... You can click anchor links just fine for pages that are genuinely separate pages. If its just a sub page, filter etc, then i think in many cases it should only swap into the dom without updating the history. Moreover, am I wrong to think that if you use hx-boost to swap in fragments, then the URL that gets updated/saved in history wouldn't actually load the same page if you loaded it from a bookmark? That wouldn't happen with non-boosted anchor links. Anyway, I'm not the best person to take up this argument. If you are interested at all in some respectful debate on the topic, it would be great if you came by the datastar discord where there's definitely people who would be better able to engage with it. I'd be eager to observe from the sidelines | | |
| ▲ | amanzi 3 days ago | parent | next [-] | | "Moreover, am I wrong to think that if you use hx-boost to swap in fragments, then the URL that gets updated/saved in history wouldn't actually load the same page if you loaded it from a bookmark? That wouldn't happen with non-boosted anchor links." It's a common pattern with Django and template partials that you check if the request is an AJAX request, in which case you just load a partial template to swap into the existing DOM. Or if it's not an AJAX request, your server-side logic loads the full template. A simple example would be a to-do list at http://example.com/todo/. Clicking on a task item would swap it into the DOM without a full page load, and then you'd update the URL and browser history to http://example.com/todo/my-task/. Then if you open that URL in a new session, your server side logic would render your page with the "my-task" already selected. | |
| ▲ | yawaramin 3 days ago | parent | prev [-] | | > If its just a sub page, filter etc, then i think in many cases it should only swap into the dom without updating the history. It depends. If it's a 'resource' (in the REST sense) then it should actually push the URL of the resource into history, because the URL should correspond to the currently viewed resource. This is exactly what I was talking about earlier, it's super important as a basic hypermedia principle. > if you use hx-boost to swap in fragments, then the URL that gets updated/saved in history wouldn't actually load the same page if you loaded it from a bookmark See amanzi's explanation or my blog post where I explain the same thing. With htmx we can easily check for the presence of a request header in the backend and serve the appropriate version of the resource: either a partial (fragment) rendering or a full page that contains the resource. I highly recommend reading my blog post: it's not a huge commitment and it will clarify these issues for you. |
|
| |
| ▲ | AtlasBarfed 3 days ago | parent | prev | next [-] | | Pay for the antipatterns? I'm too tired to parse this logic, but I suspect it is a novel entry in techcorp doublespeak/dirty tricks. | | |
| ▲ | nchmy 3 days ago | parent [-] | | I think the logic is the following: * Datastar was re-written from the ground up, numerous times. * They didn't want to update and maintain the plugins that they viewed as unnecessary/anti-patterns * People wanted them still, so they said "fine, pay us to port it". Or, do it yourself - the MIT code is sitting right there and the changes are not all that significant. You'd also learn more about D* while at it. I linked in the parent comment to the MIT code - would not be difficult for anyone to do. I suspect that in the long-run (probably not too far from now), they'll just make those plugins MIT again as the real value of Pro is the inspector, and soon their WIP web component framework (Rocket) and css framework (stellar) - all of which have always been being a commercial license. p.s. there's no techcorp here. Its literally 3 guys with day jobs donating their time to a 501c3-registered non-profit. Funds go to things like going to conferences, or holding their own. | | |
| ▲ | imiric 3 days ago | parent [-] | | > the real value of Pro is the inspector Ah, yes, a debugging tool. Only professionals need those. | | |
| ▲ | nchmy 3 days ago | parent [-] | | I can't tell what sort of sarcasm this is - whether youre saying that the inspector should be available to all, or that no one actually needs it. Whatever the case, you dont truly need it, but it is helpful. You buy it for convenience as well as to support the project. | | |
| ▲ | epolanski 3 days ago | parent [-] | | You just sound like a marketer or a cultist, and I'm not sure which one is worse. | | |
| ▲ | nchmy 3 days ago | parent [-] | | Its worse than that - I'm a cult marketer/evangelist! |
|
|
|
|
| |
| ▲ | amanzi 3 days ago | parent | prev [-] | | I'm interested in why this would be an anti-pattern? What would the alternative be? | | |
| ▲ | nchmy 3 days ago | parent [-] | | I'm not qualified to comment as I don't use the feature, but people in their Discord would be happy to explain/discuss - its a wonderful place for learning more about the web, backend architecture and more. I'm also sure this has already been explained in comments to other posts here as well. | | |
| ▲ | yawaramin 3 days ago | parent [-] | | It hasn't. Also, I'm definitely not going into the Datastar Discord. The main guy gets incredibly agitated and starts calling you names if you don't agree with him about anything lol |
|
|
|