proto-kit / framework

Apache License 2.0
28 stars 10 forks source link

Add protection against missing awaits in runtime code #199

Open rpanic opened 2 months ago

rpanic commented 2 months ago

A common pitfall that users encounter is to forget to add await to state.set() calls. This mostly leads to ambigous errors and takes up a lot of time to debug - especially when doing community support. We can approach this problem from two angles:

  1. Add better eslint coverage for missing awaits in the starter-kit
  2. Build in a framework-based solution that enforces the linearity of any runtime or protocol code. This can be done pretty easily by doing a analyzing step of all user-built code where we keep track of a global context (and how much it has been entered) for all state calls and add a slight (internally awaited) delay to force the js evaluation loop to continue elsewhere to catch missing awaits