mini-observable icon indicating copy to clipboard operation
mini-observable copied to clipboard

Bug: combineObject starts early

Open SleeplessByte opened this issue 6 years ago • 2 comments
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>>)
}

SleeplessByte avatar Mar 13 '19 13:03 SleeplessByte

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 😄

keithamus avatar Sep 06 '19 08:09 keithamus

Sure! I have the fix already somewhere so I'll extract it and merge it upstream!

SleeplessByte avatar Sep 09 '19 11:09 SleeplessByte