Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From Discord: (bug?) TypeError when using discard option with Effect.all #2972

Closed
effect-bot opened this issue Jun 10, 2024 · 1 comment · Fixed by #2977
Closed

From Discord: (bug?) TypeError when using discard option with Effect.all #2972

effect-bot opened this issue Jun 10, 2024 · 1 comment · Fixed by #2977

Comments

@effect-bot
Copy link

Summary

Summary:

  1. Issue Description:

    • User szethh encountered a TypeError when using the discard option with Effect.allWith on a record of effects. The code compiles but crashes at runtime.
    • The error does not occur if discard is set to false or omitted.
  2. Workaround:

    • User whatthebluck found that using an array instead of a record works without causing the error:
      pipe(
        [Effect.succeed(1), Effect.succeed(2)],
        Effect.allWith({ discard: true }),
        Effect.runPromise
      )
  3. Further Confirmation:

    • User datner_ confirmed the issue and noted that it also occurs with the more idiomatic form using Effect.all:
      Effect.all(
        { a: Effect.succeed(1) },
        { discard: true },
      )
    • The issue is not specific to allWith and happens regardless of concurrency and batching settings.
    • Using any mode besides default works as expected.

Key Takeaways:

  • There appears to be a bug when using the discard option with Effect.all or Effect.allWith on a record of effects.
  • The issue does not occur when using an array of effects.
  • The problem is not related to concurrency or batching settings but is specific to the default mode.
  • Using a different mode can serve as a temporary workaround.

Discord thread

https://discord.com/channels/795981131316985866/1249714696974766150

@datner
Copy link
Member

datner commented Jun 10, 2024

We should get the bot to attach sandbox links automatically I think..

https://effect.website/play#c530ae52e62e

@tim-smart tim-smart linked a pull request Jun 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants