Skip to content

Error and async handling #178

@wez

Description

@wez

Hi! I've been playing around with hypertext and I appreciate it, thank you!

I'm struggling a bit with integrating it into my application in a way that I can feel confident will scale both in terms of production workload and ergonomics in the code itself... here's a concrete use case: I have a page that embeds a number of timeseries charts.
Each time series chart is implemented as a separate component (eg: <TimeSeries name="some_name"/>), and I use htmx to ship live updates.
That works, but there are a couple of compromising aspects to the implementation:

  1. The page and component rendering must be synchronous, so any async IO (eg: loading data from anywhere) must be blocking which is problematic for servers that make heavy use of async.
  2. I haven't found an ergonomic way to handle the possibility of error, so I'm currently smooshing any failures and representing them as empty data, which I don't really like doing.

I know that I could turn these things inside out and pre-fetch all the relevant data while I'm in an async context up-front, then pass it all down, but that breaks the encapsulation that the component design promises so it doesn't feel so nice.

I wonder if you have any guidance or strategies on how best to handle these points?
Are you thinking of expanding the scope of hypertext to better-enable either or both of these in the future?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions