Skip to content

[BUG] OnUserStatusChanged not fired on real status change: equal() condition reversed in setUserState (since patch.12, still in patch.14) #1115

Description

@BlackAsia

OpenIM SDK Version

3.8.3-patch.13(electron-client-sdk / openim-sdk-core;also verified broken in patch.12 and patch.14)

OpenIM Server Version

3.8.x

SDK Platform

Electron FFI SDK

Device Model

mac

Operating System Version

ios26

Bug Description and Steps to Reproduce

Bug Description

OnUserStatusChanged is not dispatched when a subscribed user's online/offline status actually changes. Relogin / calling subscribeUsersStatus again still returns the correct snapshot, so the problem is in the change-detection gate, not in subscription or server presence data.

Root Cause

In internal/interaction/subscription.gosetUserState:

Correct (v3.8.3-patch.10):

    change[v.UserID] = v.OnlinePlatformIDs  // dispatch only when UNCHANGED — inverted!
}
if !slices.Equal(status.online, v.OnlinePlatformIDs) {
    change[v.UserID] = v.OnlinePlatformIDs  // dispatch only when changed
}

### Screenshots Link

if equal(status.online, v.OnlinePlatformIDs) {
    change[v.UserID] = v.OnlinePlatformIDs  // dispatch only when UNCHANGED — inverted!
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions