Description
Really having a good time with this soon to be "real" project 😂 made a wrapper around fetch https://github.com/davidchase/yet-another-fetch which somewhat works the way I want but wanted to get some thoughts..
currently with yet
:
import {runTask, task} from '@briancavalier/yet'
const listTask = task(resolve => resolve([1,2,3]))
const [kill, futureValue] = runTask(listTask)
futureValue.map(console.log) //=> 1, 2, 3
i think the expected should be the [1, 2, 3]
list?
I first noticed it with yet-another-fetch because futureValue.map(console.log)
was logging a value instead of an Either
From what i gather the culprit is F.map
and it does the check for if x has map and then uses it
https://github.com/briancavalier/yet/blob/master/src/FutureValue.js#L52
https://github.com/briancavalier/yet/blob/master/src/FutureValue.js#L67
my current workaround is just to do f(future.value)
and this.f(value)
respectively so maybe we don't need to use F.map
in that case... thoughts?
really digging the ability to kill off a task especially with fetch because i can prevent the request from happening altogether 👍