Live data from Hacker News

Make any TypeScript function durable

useworkflow.dev

41–50 of 89 posts

Re: Make any TypeScript function durable

#42

Use client and use server aren’t great, but the fact they had to be declared at the top of a file was at least clear. Starting to scatter magic strings throughout a code base feels like a real step back.

There's nothing about "use server" that requires it to be at the top of the file though, it can go in function bodies and you have a typed RPC method. I think "use client" is the only one that has to go at the top of a file.

You are correct. Use server can be slapped in many places

Re: Make any TypeScript function durable

#43

So vercel is adamant on making nextjs apps behavior completely unpredictable and hidden behind tons of magic code? At least in any other framework library I can just command click and see why things are not working, place breakpoints and even modify code.

It’s a great business model with epic lock in. Bored front end devs keep indulging / enabling it so why stop?

Re: Make any TypeScript function durable

#44
post #4
post #2

Of all the syntax options they could've gone with, they settled on what I would say is arguably the worst. If you want a one-liner, decorators are widely used across different languages and Typescript supports them as well.

Yea but it's a vercel product and they also pushed the 'use server' and 'use client' directives and probably want to build on them.

Absolutely bizarre decisions.

Re: Make any TypeScript function durable

#45
post #19

This is actually pretty cool. We have a similar custom library at Xbox that's used extensively across all of our services. I do wish that there was some kind of self-hostable World implementation at launch. If other PAAS providers jump onto this, I could see this sticking around.

Hi I’m Gal from the team. Thanks! We did ship a reference Postgres implementation. It would receive more love now that we open sourced, but we can’t call it “production ready” without running it in production.

But we did have convos in the last couple of days on what we can do next on the pg world ;D

Re: Make any TypeScript function durable

#46

can anyone point to the "Durable" part? looking at the docs and examples, I see Workflows and Steps and Retries, but I don't see any Durable yet. none of the examples really make it clear how or where anything gets stored

That depends on the “world”. We built an adapter interface so you could store the data (and other things) anywhere you want. There are some docs which are wip regarding that: https://useworkflow.dev/docs/deploying/world

Re: Make any TypeScript function durable

#47

So this seems similar to https://temporal.io/ , am I reading this right? I used that briefly a few years ago and it was pretty nice at the time. It did make some features much easier to model like their welcome email example. Would love to hear from someone with extensive temporal experience, iirc the only drawback was on the infra side of things.

And to DBOS too

Re: Make any TypeScript function durable

#48
It's not really clear how you "update" a workflow/step method?

What happens if you saw a bug, or you want to update and change a workflow? Is there a way to discard / upgrade the existing in-memory workflows that are being executed (and correspond to the previous version) so they are now "updated"?

Re: Make any TypeScript function durable

#49
post #30

Earlier quoted context omitted.

Since this magic string requires a preprocessor step anyway, there's no reason they couldn't make it a decorator that works on functions. I don't see the problem?

But then it's not valid TypeScript anymore. So all the other tooling breaks: syntax highlighting, LSP, Linter, ...

Looking at the AST [0], this doesn't seem to be the case. Since Typescript already supports decorators in other contexts, it successfully parses everything and identifies the decorator to boot. Since you're working in a preprocessor context anyway, there's a number of options to make all of this work well together.

[0] https://ts-ast-viewer.com/#code/GYVwdgxgLglg9mABMOcAUBKRBvAU...

Re: Make any TypeScript function durable

#50

So vercel is adamant on making nextjs apps behavior completely unpredictable and hidden behind tons of magic code? At least in any other framework library I can just command click and see why things are not working, place breakpoints and even modify code.

[deleted]
Post reply on HN