-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi, as discussed on gitter here is the code that causes the issue :
import xs from 'xstream'
import {makeRemoteDataDriver} from 'cycle-remote-data'
const cachedDriver = () => {
const {request} = makeRemoteDataDriver()
const makeRequest = (path) => request({method: 'GET', url: `${HTTP_ENDPOINT}/data/${path}`})
let cache = {}
return {
query(query) {
if (cache[query]) { return cache[query] }
return cache[query] = makeRequest(query).remember()
}
}
}
const repository = cachedDriver()
xs.periodic(1000).map(() =>
repository.query('heey')
.map(res => res.when({
Loading: () => 'l',
Ok: () => 'o',
Error: () => 'e',
}))
)
.flatten()
.debug()
.addListener({})expected:
----l-o--o----o----o---->
got:
----l-o--l-o--l-o--l-o-->
As you said, this is a hot vs cold thing
And thanks again for the cool library btw
Metadata
Metadata
Assignees
Labels
No labels