Skip to content

Commit

Permalink
fix: Fix pending count
Browse files Browse the repository at this point in the history
  • Loading branch information
Quenty committed Nov 12, 2024
1 parent 1cb250d commit 7414df3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/rx/src/Shared/Rx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1448,27 +1448,26 @@ 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
latest[key] = value
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(...)
Expand Down

0 comments on commit 7414df3

Please sign in to comment.