Skip to content

Compiler: promises don't work well for nested operations #1225

@josephjclark

Description

@josephjclark

This doesn't work:

fn((state => {
   fn()(state).catch((error, state) => state)
})

The promise in the nested operation isn't compiled. so the catch isn't fed the state object

There could be two things at play here:

  1. That extra function call in fn()(state).catch() is likely to be violating the compiler's expectations
  2. I think promises are only compiled top level? We don't really have any business compiling code in a callback like this. We don't know if passing state is appropriate - usually it's not

See Hunter's use case

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    DevX Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions