Skip to content

Commit e60e95e

Browse files
authored
Merge pull request #16 from C6H15/fix/observer-unsubscribe-exit
Fix exit callbacks not firing on Observer unsubscribe
2 parents b4dac95 + 159b3c7 commit e60e95e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/Classes/Observer.luau

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,20 @@ local function disconnectObserverFromGroup(observerId: number, group: Types.Inte
6666
dirtyProfiles[entity] = true
6767
dirtyTopology[entity] = true
6868

69-
local activeObservers = State.entityToObservers[entity] or {}
7069
local oldZoneId = data.activeObserverMemberships[observerId]
70+
if not oldZoneId then
71+
continue
72+
end
73+
74+
local stillTracked = false
75+
for groupId in (State.entityToObservers[entity] or {}) do
76+
if State.groupToObservers[groupId] and State.groupToObservers[groupId][observerId] then
77+
stillTracked = true
78+
break
79+
end
80+
end
7181

72-
if not oldZoneId or activeObservers[observerId] then
82+
if stillTracked then
7383
continue
7484
end
7585

0 commit comments

Comments
 (0)