matrix-js-sdk icon indicating copy to clipboard operation
matrix-js-sdk copied to clipboard

Inconsistent behavior with membership events in `state` for left rooms

Open gingershaped opened this issue 2 months ago • 1 comments

According to the Matrix specification, the state property of a room's sync response includes state events up to the start of the timeline property. While improving continuwuity's leave handling, I created sync responses that looked like this:

{
    "left": {
        "!abcd:matrix.org": {
            "state": {
                "events": [
                    {
                        "type": "m.room.member",
                        "state_key": "@ginger:gingershaped.computer",
                        "membership": "join"
                    }
                ]
            },
            "timeline": {
                "events": [
                    {
                        "type": "m.room.member",
                        "state_key": "@ginger:gingershaped.computer",
                        "membership": "leave"
                    }
                ]
            }
        }
    }
}

The Cinny client (which uses the matrix-js-sdk) prioritizes the join event in state over the leave event in timeline, which I believe to be incorrect behavior since state events in timeline should (as I understand it) override events in state.

gingershaped avatar Nov 06 '25 14:11 gingershaped

There are a multitude of issues with the above, which are intended to be sorted by state_after from Matrix v1.16. We will not be fixing issues with legacy spec approaches, though would accept contributions.

t3chguy avatar Nov 06 '25 14:11 t3chguy