@rbxts/covenant 3.7.1 → 3.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/hooks.luau +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/covenant",
3
- "version": "3.7.1",
3
+ "version": "3.7.2",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/hooks.luau CHANGED
@@ -22,13 +22,16 @@ local function createUseEvent(_param)
22
22
  if not watchedEvents:has(instance, event) then
23
23
  watchedEvents:add(instance, event)
24
24
  queues:set(instance, event, {})
25
- event:Connect(function(...)
25
+ local connection = event:Connect(function(...)
26
26
  local args = { ... }
27
27
  local _exp = queues:get(instance, event)
28
28
  local _args = args
29
29
  table.insert(_exp, _args)
30
30
  indicateUpdate()
31
31
  end)
32
+ instance.Destroying:Once(function()
33
+ connection:Disconnect()
34
+ end)
32
35
  caches:set(instance, event, {})
33
36
  return {}
34
37
  end