Those discussions about 'use workflow' remind me something!
I did something just a little cursed
For context, I wanted a way to "fork" generators so new iterators could be created at any yield point. Those new iterators had their own stack and could progress without impacting the original iterator (assuming they only had access to immutable data structures).
The Next.js workflow stuff is very similar; the difference is that instead of creating the new iterator right away they serialize it. Future forks only need to be restored from that snapshot.
Oct 27, 2025 09:59One of the tricky part I faced was that to make this work, you need to turn the function into a state machine. With loops, initializers, etc it's not exactly trivial.