From 7414df389c4d481673b0afee78fd6b20e332d8d2 Mon Sep 17 00:00:00 2001 From: James Onnen Date: Tue, 12 Nov 2024 12:59:41 -0800 Subject: [PATCH] fix: Fix pending count --- src/rx/src/Shared/Rx.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/rx/src/Shared/Rx.lua b/src/rx/src/Shared/Rx.lua index c54053d7ef..0f5804bf6c 100644 --- a/src/rx/src/Shared/Rx.lua +++ b/src/rx/src/Shared/Rx.lua @@ -1448,14 +1448,12 @@ function Rx.combineLatest(observables) assert(type(observables) == "table", "Bad observables") return Observable.new(function(sub) - local pending = 0 local unset = 0 local latest = {} -- Instead of caching this, use extra compute here for key, value in pairs(observables) do if Observable.isObservable(value) then - pending += 1 unset += 1 latest[key] = UNSET_VALUE else @@ -1463,12 +1461,13 @@ function Rx.combineLatest(observables) end end - if pending == 0 then + if unset == 0 then sub:Fire(latest) sub:Complete() return end + local pending = unset local maid = Maid.new() local function failOnFirst(...)