Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/package/matter-hooks/useReducer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ local diffTables = require(Package.diffTables)
end

if increaseCondition then
dispatch("increase")
dispatch({
type = "increase",
})
elseif decreaseCondition then
dispatch("decrease")
dispatch({
type = "decrease",
})
end
```

Expand Down
46 changes: 25 additions & 21 deletions lib/package/matter-hooks/useStream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,39 +194,43 @@ local function useStream(id: unknown, options: StreamOptions?): () -> (number?,
storage.queue:push(streamInEvent(instance, true))
end),

removingConnection = instance.DescendantRemoving:Connect(function(instance: Instance)
storage.queue:push(streamOutEvent(instance, true))
end),
removingConnection = instance.DescendantRemoving:Connect(
function(instance: Instance)
storage.queue:push(streamOutEvent(instance, true))
end
),
}

for _, descendant in instance:GetDescendants() do
storage.queue:push(streamInEvent(descendant, true))
end
end)

storage.removingConnection = Workspace.DescendantRemoving:Connect(function(instance: Instance)
if instance:GetAttribute(options.attribute) ~= id then
return
end
storage.removingConnection = Workspace.DescendantRemoving:Connect(
function(instance: Instance)
if instance:GetAttribute(options.attribute) ~= id then
return
end

storage.queue:push(streamOutEvent(instance))
storage.queue:push(streamOutEvent(instance))

if not options.descendants then
return
end
if not options.descendants then
return
end

for _, descendant in instance:GetDescendants() do
storage.queue:push(streamOutEvent(descendant, true))
end
for _, descendant in instance:GetDescendants() do
storage.queue:push(streamOutEvent(descendant, true))
end

local connections = storage.trackedInstances[instance]
if not connections then
return
end
local connections = storage.trackedInstances[instance]
if not connections then
return
end

connections.addedConnection:Disconnect()
connections.removingConnection:Disconnect()
end)
connections.addedConnection:Disconnect()
connections.removingConnection:Disconnect()
end
)
end

local index = 0
Expand Down