reflux / refluxjs

A simple library for uni-directional dataflow application architecture with React extensions inspired by Flux
BSD 3-Clause "New" or "Revised" License
5.36k stars 330 forks source link

async actions return undefined instead of Promise #548

Open andpor opened 6 years ago

andpor commented 6 years ago

I have an action defined as

doSomething: { asyncResult: true}

in the code I have

doSomething("some params").then(..).catch(...)

This used to work in 0.2.x versions. After upgrade to 5.0.4 action invocation started to return undefined which naturally was throwing a JS exception.

Why is this no longer working? What is an alternative approach if this is not a bug?

andpor commented 6 years ago

I tried using reflux-promise@1.0.4 but npm warns about required peer of reflux-core^0.3.0 not installed. I am hesitant to install reflux-core^0.3.0 since reflux@5.0.4 wants reflux-core^0.4.3...

doSomething.triggerAsync("some params").then(..).catch(...)

does not work. undefined is returned by triggerAsync...

javobal commented 6 years ago

Did you find a solution for this ?, i have a similar problem. i updated this library from 0.1.x and i originally used listenAndPromise but it seems is no longer an option.

andpor commented 5 years ago

I just could not get this to work which is a shame. I created a workaround by passing in a callback into action, execute a promise inside action handler which eventually invokes the callback...not exactly a clean solution but I had to make it work...