Description
Summary
The user is experiencing confusion while using the effect/sql-drizzle
library with Effect.promise
in TypeScript. The library is supposed to patch Drizzle to return effects, yet when the user calls $returningId
without wrapping it in Effect.promise
, it returns an empty array. However, when wrapped with Effect.promise
, it returns the expected result, including the ID.
Key takeaways:
-
Expected Behavior: The
effect/sql-drizzle
library should handle calls with effects directly without needingEffect.promise
, which is used for working with promises. There's confusion regarding why it is necessary for$returningId
. -
Potential Issue: The behavior when
$returningId
is not wrapped withEffect.promise
might indicate a bug, given it returns an empty array incorrectly. -
Reproduction Case: The user provides a TypeScript reproduction case demonstrating the issue, showing how
Effect.promise
affects the output.
The user is advised to make a reproduction case to verify if the behavior might be a bug, and the reproduction indeed sketches out the observed difference in behavior of the $returningId
method with and without Effect.promise
.
Discord thread
https://discord.com/channels/795981131316985866/1389688184350310501