unistore icon indicating copy to clipboard operation
unistore copied to clipboard

Add thunk-like action

Open jaredpalmer opened this issue 7 years ago • 7 comments

jaredpalmer avatar Feb 13 '18 16:02 jaredpalmer

I guess this would just be actions that invoke a callback to signify completion rather than returning a promise?

developit avatar Apr 27 '18 02:04 developit

Yup

jaredpalmer avatar Apr 27 '18 17:04 jaredpalmer

I'm on the fence about this one. I wonder if what we really need is middleware... Right now I'm not sure how we'd be able to support thunks since we already use returned functions as a way to detect promisified actions. Any thoughts on a way to do it? If we could find a solution, the plumbing should be literally just another line here.

developit avatar May 06 '18 01:05 developit

unistore can support this out of the box if it has middleware support or something like that.

aprilmintacpineda avatar Jun 12 '18 05:06 aprilmintacpineda

@developit I want to help but I don't know what's on your mind. I can only picture this with an event driven architecture, as far as I can see, unistore is not event driven since we literally fire the actions which are functions instead of firing an event.

aprilmintacpineda avatar Jun 12 '18 05:06 aprilmintacpineda

@aprilmintacpineda I looked at how redux applies middleware cuz it's nicely documented. I have a proof of concept for generic middleware support in unistore running locally, and will put up a fork soon that hopefully doesn't add too many bytes!

eschaefer avatar Aug 16 '18 19:08 eschaefer

Hey all, check out #109 for a really basic support for thunks. 🤷‍♂️

eschaefer avatar Aug 17 '18 20:08 eschaefer