Skip to content

From Discord: Confusion About Using Effect.promise with effect/sql-drizzle #5126

Open
@effect-bot

Description

@effect-bot

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:

  1. Expected Behavior: The effect/sql-drizzle library should handle calls with effects directly without needing Effect.promise, which is used for working with promises. There's confusion regarding why it is necessary for $returningId.

  2. Potential Issue: The behavior when $returningId is not wrapped with Effect.promise might indicate a bug, given it returns an empty array incorrectly.

  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions