day8 / re-frame-http-fx

A re-frame "effects handler" for performing Ajax tasks (via cljs-ajax)
MIT License
259 stars 26 forks source link

:finally does not work? #28

Closed ertugrulcetin closed 5 years ago

ertugrulcetin commented 5 years ago

I've added :finally keyword to the request map. But it's not getting called.

danielcompton commented 5 years ago

I haven't looked at http-fx for a while, so I might be forgetting something, but I don't think this library supports a :finally keyword. Did you read some docs somewhere that talked about this?

ertugrulcetin commented 5 years ago

@danielcompton It uses ajax.core (cljs-ajax) library under the hood, so I thought :finally will be supported. Because http-fx creates it's own request-map and hand it to ajax.core.

danielcompton commented 5 years ago

Ah, of course. I can't see anything that we're doing that would inhibit the :finally from being called. Have you tried stepping through in a debugger to see if the finally is being hit? Can you share a code sample showing how you're calling it?

danielcompton commented 5 years ago

Ah, now I think about it, I think that :finally might only be supported in the simple API, not the ajax-request one that we use.

ertugrulcetin commented 5 years ago

Hmm I think if the lib supports core API that would be wonderful. Otherwise we have to provide :finally fn to both on-success and on-fail fns.

danielcompton commented 5 years ago

The lib doesn't support the simple API, and isn't likely to in the near future. For now, providing the :finally function is probably your best bet, or you could write a simple adapter for the GET and POST cljs-ajax functions to turn them into effects. Will close this for now, as there's not much we can do here.