Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm still trying to figure out what the key difference would be when writing an app with Datastar over HTMX.

I wrote /dev/push [1] with FastAPI + HTMX + Alpine.js, and I'm doing a fair bit with SSE (e.g. displaying logs in real time, updating state of deployments across lists, etc). Looking at the Datastar examples, I don't see where things would be easier that this [2]:

    <div
      hx-ext="sse"
      sse-connect="{{ url_for('project_event', team_id=team.id, project_id=project.id) }}"
      sse-close="sse:stream_closed"
    >
      <div
        hx-trigger="sse:deployment_creation, sse:deployment_status_update, sse:deployment_rollback, sse:deployment_promotion"
        hx-get="{{ url_for('project_deployments', team_slug=team.slug, project_name=project.name).include_query_params(fragment='deployments') }}"
        hx-target="#deployments"
      ></div>
    </div>
Also curious what others think of web components. I tried to use them when I was writing Basecoat [3] and ended up reverting to regular HTML + CSS + JS. Too brittle, too many issues (e.g. global styling), too many gaps (e.g. state).

[1]: https://devpu.sh

[2]: https://github.com/hunvreus/devpush/blob/main/app/templates/...

[3]: https://basecoatui.com



BTW, this comment is very true when dealing with HTMX as well:

> But what I’m most excited about are the possibilities that Datastar enables. The community is routinely creating projects that push well beyond the limits experienced by developers using other tools.

For example when displaying the list of deployments, rather than trying to update any individual deployment as their state is updated, it's just simpler to just update the whole list. Your code is way simpler/lighter as you don't need to account for all the edge case (e.g. pager).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: