inlang project: async function calls should be async #1272
-
Problem
The reactive system treats async operations like ExampleThe production code below struggles with awaiting an update operation and introduces a workaround by awaiting a promise that will eventually resolve. A gateway to bugs by thinking "this is sync, why is my message not immediately update?", forgetting to establish such a workaround, maybe the timeout is too fast, etc. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Proposal - Treat async as asyncGetting lint reports or updating messages are async operations and treat them as such. Pros
Cons
// on first call, the lint system is initialized. subsequent calls are immediately resolving.
await inlang.lint.reports()
// awaiting a message update that will resolve once the message is updated
await inlang.query.messages.update()
// treating query as async has another benefit: we open the door for lazy fetching of messages in the future
await inlang.query.messages.get() Additional information
|
Beta Was this translation helpful? Give feedback.
-
@inlang/team another day another problem. i used discussions to enable better multi-proposal conversations (the proposal is not part of the problem description) |
Beta Was this translation helpful? Give feedback.
-
Progress is tracked in #1290 |
Beta Was this translation helpful? Give feedback.
Progress is tracked in #1290