helix

2022-06-08T21:18:48.396539Z

How do you fellow helixers fetch on the browser ? Do you use js/fetch or its wrapper https://github.com/lambdaisland/fetch or something else.

2022-06-12T18:26:30.871819Z

I think I've found an issue in https://github.com/lambdaisland/fetch/issues/19

Brandon Stubbs 2022-06-09T13:11:59.874569Z

https://github.com/funcool/promesa

2022-06-09T14:58:34.740919Z

promesa looks well written/behaved wrapper. No dependencies, documentation.

Brandon Stubbs 2022-06-09T14:59:27.067749Z

Yeah, I trust most of the funcool libs, they are battle tested in https://github.com/penpot/penpot

2022-06-09T23:28:26.162809Z

@brandon746 Didn't knew about this project. Thank you for pointing it.

💙 1
2022-06-11T18:30:18.924769Z

https://github.com/lambdaisland/fetch/blob/main/src/lambdaisland/fetch.cljs#L106 this p/try block from kitchen-async has no equivalent on promesa, so i changed the p/let inside the p/try to . That proves @dominicm point, native .then and .catch are more than enough for operations. I'm using p/promise constructor on decode-body in case the implementation (its a multi-method) does not give a promise back.

2022-06-11T18:50:02.436139Z

the fetch operation https://github.com/lambdaisland/fetch/blob/main/src/lambdaisland/fetch.cljs#L105 is not being guarded by the p/try block, which opens the door to something wrong with it. the p/let block captures a response, the fetch api says it does not reject on 404 errors. it only rejects on network errors. the next promise operation is https://github.com/lambdaisland/fetch/blob/main/src/lambdaisland/fetch.cljs#L113 decode-body. I wonder how the https://github.com/athos/kitchen-async/blob/master/src/kitchen_async/promise.cljc#L126 p/try from kitchen-async is able to intercept rejected promises on the code. I know the code is there but my brain is not lispy enough to understand how. Is it really feasible ? because the native promise handling is dependent on chainning, and I think promises are different from exceptions semantically.

2022-06-12T00:51:29.798149Z

despite the kitchen-async dependency pulling core.async, I liked lambdaisland.fetch. It pairs with muuntanja at server side, which responds to content-type. It defaults to asking for transit content, and has multi-methods to decode body based on the content-type.

dominicm 2022-06-08T22:14:47.393099Z

I use js/fetch

2022-06-08T22:27:13.145099Z

@dominicm Do you use a library for promises ?

2022-06-08T23:05:46.130729Z

No I remember: lambdaisland pulls kitchen-async which pulls core-async which is on hold for https://www.juxt.pro/radar 2021

dominicm 2022-06-09T02:23:34.920319Z

I don't. I'm passing the JSON as a JavaScript object around