mini-observable
mini-observable copied to clipboard
Bug: combineObject starts early
trafficstars
Because of combineobject.ts#L21, given this case:
sources o.a: |-------1--------2---------------------- 3------|
sources o.b: |-----------------------------1----------2------|
// expected
combineObject(o): |------------------------{a:2,b:1}---{a:3,b:2}--|
// actual
combineObject(o): |-------------{a:2}------{a:2,b:1}---{a:3,b:2}--|
I think the fix is something along the line of
const started: Partial<Record<keyof S, true>> = {}
...
next(value) {
started[name] = true
values[name] = value
Object.keys(started).length === total && next(values as Record<keyof S, InferT<S, T>>)
}
Thanks for raising this issue @SleeplessByte! Also thanks for all the awesome PRs you've been making! I've invited you as a collaborator to this project so you can work on it as you see fit.
The fix you have looks fine to me also! Happy to see a PR for this, or if you want to commit to master, go right ahead 😄
Sure! I have the fix already somewhere so I'll extract it and merge it upstream!