Skip to content

Commit fce6fbf

Browse files
committed
fix
1 parent cae786e commit fce6fbf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

location/src/main/kotlin/io/customer/location/ModuleLocation.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,16 @@ class ModuleLocation @JvmOverloads constructor(
7575
val previousUserId = lastKnownUserId
7676
lastKnownUserId = it.userId
7777

78-
if (!it.userId.isNullOrEmpty()) {
78+
if (it.userId.isNullOrEmpty()) {
79+
// User logged out — clear synced data so the next user is not
80+
// suppressed by the previous user's 24h/1km window. Handled here
81+
// (not only in the ResetEvent subscriber) because both subscribers
82+
// run in separate coroutines and the UserChangedEvent for the new
83+
// user could arrive before the ResetEvent subscriber clears state.
84+
if (!previousUserId.isNullOrEmpty()) {
85+
locationTracker.onUserReset()
86+
}
87+
} else {
7988
// Clear synced data when switching between identified users so the
8089
// new user is not suppressed by the previous user's 24h/1km window.
8190
if (!previousUserId.isNullOrEmpty() && previousUserId != it.userId) {

0 commit comments

Comments
 (0)